Hey yall. Trying to get a photoresistor to work and I can't seem to make any progress, it only seems to detect max voltage. Any signs of where I'm going wrong in the breadboard or in the code. The later code isn't finished yet but it shouldn't effect it as it revolves around received readings.
#include <Adafruit_NeoPixel.h>
#define NEOPIXELPIN 11
#define NUMPIXELS 5
Adafruit_NeoPixel pixelStrip = Adafruit_NeoPixel(NUMPIXELS, NEOPIXELPIN, NEO_GRB +
NEO_KHZ800);
// ----------------------------------------------------------------¬
void setup() {
pixelStrip.begin();
Serial.begin(9600);
}
// ----------------------------------------------------------------¬
void loop() {
int reading;
float voltage;
reading = analogRead(A5);
voltage = reading*(5.0/1023.0);
if (voltage<2.0) {
Serial.print(voltage);
Serial.print(" ");
Serial.println("Dark turn on all pixels");
} else if (voltage>2.3 && voltage<=4.3) {
Serial.print(voltage);
Serial.print(" ");
Serial.println("Low light, turn on pixels to a pleasant color");
}else{
Serial.print(voltage);
Serial.print(" ");
Serial.println("Bright enough, turn off all pixels");
}
}
The produced readings are as follows


