I'm using a -12E with three light sensors and a sketch I've successfully used with an Uno. I cannot get the -12E to print anything but 0 or 1023 for a light level (0 when I connect the grounds, 1023 without grounds).
I've successfully printed from a single light sensor but now I'd like to try three.
I'm curious to know what I'm missing. Any guidance would be appreciated.
Code is as follows:
const int photocellPin_0 = 16; // D0
const int photocellPin_1 = 5; // D1
const int photocellPin_2 = 4; // D2
int photocellReading_0;
int photocellReading_1;
int photocellReading_2;
void setup() {
delay(4900);
Serial.begin(115200);
Serial.println("Startup");
delay(100);
pinMode(photocellPin_0, INPUT);
pinMode(photocellPin_1, INPUT);
pinMode(photocellPin_2, INPUT);
}
void loop() {
delay(1000);
photocellReading_0 = analogRead(photocellPin_0);
photocellReading_1 = analogRead(photocellPin_1);
photocellReading_2 = analogRead(photocellPin_2);
Serial.println("-----NEW ON READING-----");
Serial.print("Photo Sensor #1 = ");
Serial.println(photocellReading_0); // the raw analog reading
Serial.print("Photo Sensor #2 = ");
Serial.println(photocellReading_1);
Serial.print("Photo Sensor #3 = ");
Serial.println(photocellReading_2);
delay(5000);
}
This is based on an adafruit sketch I pulled off of some website (modified for three photo sensors) and I'd credit it if I could recall exactly where I got it from.