Friday

Arduino Basics - ReadAnalogVoltage

click to enlarge
Today we will look at yet another example in Arduino Basics. It is called ReadAnalogVoltage. You can find this program in the File - Examples - Basics.

If you have ever used a multimeter to check voltage across an electronics circuit, you can think of this experiment as a simulator of the same.


I have created a trimmed version of the same program, it will help you to quickly understand the programming. After that it will be easier to understand the program in the example.


Here in the setup() function we initiate a serial communication with 9600 baud rate. In the loop() function the input on the analog pin A0 is read by the function analogRead() 

The voltage read at the pin A0 will vary between 0 and 5 volts. The ADC Analog to Digital converter will map this value between 0 to 1023. We will store this value in the integer variable x. 

Now we will convert this value back into voltage so as it display on the screen. Thus we get the value of the voltage in the float variable v and print it in the Serial monitor or the plotter. 

click to enlarge


  

Featured Post

Creating Games in Scratch for ICSE Class 6

An Introduction to Creating Games in Scratch  for ICSE Class 6 Hello friends, I hope you have already read the previous post on An Int...