Usint I2c LCD and other analog pins not working

Greetings!

I have a stepper motor project I am working on to control a telescope mount. Motor divers are controlled from the digital pins and there is a potentiometer on analog pin A0 to control the speed of the stepper motors. There is a Bluetooth Xbee on the Nano shield (using D0 & D1) for Bluetooth communications. Everything was working just fine until I added an i2c LCD (on A4 & A5) to the Arduino Nano.

Now, the analog pins not being used by the i2c LCD will not work. Rather than reading the mapped value of the potentiometer, I get a reading of anywhere from 350 to 357 on pins A0 - A3 & A6-A7...(the reading should be anywhere between 300-4000) and the value does not change with the potentiometer.

Any thoughts?

The system is using the libraries Wire.h and LiquidCrystal_I2C.h and the address of the LCD is 0x27.

I have looked through the libraries and cannot find anything in either one of those files that might effect the other analog pins and I am stuck.

Any thoughts would be very appreciated.

Thanks

Power supply?

the reading should be anywhere between 300-4000)

The analogRead() function does not return values above 1023, so that assumption is wrong.

I'm going to guess that that is not the only incorrect assumption you are making.

Post a schematic and some code.

Attached is the code that I am using for the telescope project...I hope this helps.

The pin assignments will tell you where everything is connected and it all worked until I connected the I2C LCD.

Tonys_Stepper_Motor_Control_With_Bluetooth_and_Pololu_Stepper_3.ino (4.92 KB)

            while(BluetoothData=='B') {
              digitalWrite(Motor_1_Step_Pin,HIGH);
              delayMicroseconds(customDelayMapped);
              digitalWrite(Motor_1_Step_Pin,LOW);
              delayMicroseconds(customDelayMapped);
            }

I hope you never plan to send a 'B' to the Arduino. You'll be stepping until the universe ends.

int speedUp() {
  int customDelay = analogRead(Pot_Pin);
  int newCustom = map(Pot_Pin, 0, 1023, 300, 4000);
  return newCustom;
}

Interesting. Mapping the pin number to that range doesn't make sense.

Remember...everything worked until the connection of the I2c LCD...that is when the potentiometer and the analog pins stopped working.

Remember...everything worked until the connection of the I2c LCD...that is when the potentiometer and the analog pins stopped working.

That function, as written, NEVER returned anything but 337.

Is that a question or a statement?

SpeedBoat:
Is that a question or a statement?

Did you see a question mark? I didn't type one because it is a statement.

Why 337?