Photoresistor, Tutorial #6

Cool. I am getting serial monitor readings between ~120, when the photoresistor is in the dark, and ~920 when it is exposed to indoor lighting. Your tutorial writing is exceptionally clear and concise, if I may say so. I noticed these new functions in your sketch:

int lightCal;

int lightVal;

lightCal = analogRead(sensorPin);

Serial.begin(9600);

lightVal = analogRead(sensorPin);

Serial.println(lightVal);

if(lightVal < lightCal - 50)

digitalWrite(9,HIGH);

digitalWrite(9,LOW);

Darrellg, your sketch works with the same wiring scheme as the previous project. The LED lights when the photoresistor is shaded, serial monitor prints low numbers; LED gets dim when exposed to ambient light, serial monitor prints high numbers. That’s important to me, because I am imagining a project with different sensors, and either a LED or buzzer, along with printed data, to verify that the sensor is working, and that it’s not my imagination.

I am also looking at this page, a glossary of serial function (and a few examples) https://www.arduino.cc/en/Reference/Serial

The possibilities are mind boggling!