Reading/Displaying Analog Voltage Data from Potentiometer

Hi guys,

I hooked up a poteniometer to my Genuino Uno board where I connected the potentiometer wiper to A0 analog input port, the ground to the ground of board, and the voltage pin to 3.3 V pin.

However, when running the simple code:

int sensorPin = A0;

void setup() {
Serial.begin(9600);
}

void loop() {
int sensorValue = analogRead(sensorPin)/4;
Serial.println(sensorValue);
delay(10);
}

It displays non-readable values (i.e., ˜€˜ø˜˜€˜ø). Any idea why?
I tried all the print and write command formats:
Serial.println(sensorValue, DEC); // print as an ASCII-encoded decimal
Serial.println(sensorValue, HEX); // print as an ASCII-encoded hexadecimal
Serial.println(sensorValue, OCT); // print as an ASCII-encoded octal
Serial.println(sensorValue, BIN); // print as an ASCII-encoded binary

and how I can display the correct voltage values?

Many thanks

Hi,
See the Page HERE for code that is tested..

Make sure you have the Serial Monitor baud rate (lower right) set right.

Many thanks for your help. It worked out just fine now. :slight_smile: