# How to Read Voltage Level? [closed]

``````volts = analogRead(A3);    // read the input pin
Serial.println(volts)
``````
• Show where and how in your code you declare `volts`, and how are you wiring the voltage you want to read to the analog input. – Enric Blanco May 11 '17 at 8:40
• Also, in what way is this not working? – Mark Smith May 11 '17 at 10:57
• Other than missing the semicolon on the end of the second line, this chunk of code will work. Can you please show your whole program? – sa_leinad May 11 '17 at 12:53
• Note that instead of printing out the number of volts on the input, it will output an ADC count that stands for some number of volts; by default, 1024/5 counts per volt. – James Waldby - jwpat7 May 11 '17 at 13:53

//use this syntax and add ; sign at end of each line and try to read voltage level via voltage divider circuit.

``````volts = analogRead(A3);    // read the input pin
Serial.println(volts);             // debug value
``````

First off you need to convert your signal's units from analog -> voltage. Do this by using the following equation. I've modified your code so you can copy and paste it into your IDE.

``````float volts = analogRead(A3) * ( 5.0 / 1024.0) ;
``````

Hope this helps! Good luck!

• Your first solution will always be 0. `5 / 1024` does integer division which always results in 0. Any number multiplied with 0 is then 0. – gre_gor May 11 '17 at 19:17
• @gre_gor I stand corrected! Good catch. I completely forgot about that. :) – L. Paw May 11 '17 at 21:19