SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By tooom
#192680
I have written the following sketch:
Code: Select all
void setup() {
  Serial.begin(9600); 
}

void loop()  {  
  
    int sensorValue = analogRead(A0);
    float voltage = sensorValue * (5.0 / 1023.0);
    Serial.println(voltage);
    delay(1000);
 }
At first I used my Arduino Uno with the following setup: https://www.arduino.cc/en/Tutorial/ReadAnalogVoltage

It works fine since by regulating the potentiometer I am getting different readouts like 0.00 up to 5.00 depending on the amount of resistance.

Now, I simply want to run this program on the Pro Micro 5V/16Mhz. I connected the potentiometer imo appropriately and and uploaded the sketch. However, in that case I am constantly getting something inbetween 0.94volt and 1.21volt independently of the setting of the potentiometer - it just varies randomly. So, I thought that I should remove the potentiometer. But, that did confuse me even more since the randomly varying measurements of 0.94volt and 1.21volt remain the same regardless of a connected potentiometer.

Anybody got an idea why this super simple setup works on Arduino Uno but not on the Pro Micro?