hi guys,
I have 2 LDR resistors hooked up to test, hoping to make a photovore as my first real project, but no matter what I do i can only get a readout from the first one,
I have the wiring like this:
5v (common) - 1k resistor - (wire to analog pin) + another wire from resistor to LDR - LDR to ground
exactly the same wiring for each LDR, I want to use analog input 0 and 1, but I have tried in every combination accross all the analog pins, and no matter what I try I only get the input for the first LDR, I have tried swapping the LDRs in case one of them was faulty, but no matter what way around all I get is the readout of the first one
my code is this:
int reading1;
int reading2;
void setup()
{
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);
}
void loop()
{
reading1 = analogRead(A0);
delay(5);
reading2 = analogRead(A1);
Serial.print("sensor 1 = ");
Serial.print(reading1);
Serial.print(" sensor 2 = ");
Serial.println(reading2);
delay(500);
}
and all i get as a readout is:
I really don't get what I'm doing wrong here, as I know both LDRs work, and the wiring is the same for both, all i can think is either there is something wrong with my code, or something broken in my arduino.
thanks