I am posting in this forum because my question is still undefined. For background, it concerns a question I asked about a tutorial for dimming a LED with a photoresistor, a week ago. The experiment worked, but in my opinion the effect was not robust, because judging the dimming or the opposite of a LED was too subjective on the observer. So, I asked (Feb. 21 Projects) how to simply turn the LED on-or-off at a specific photoresistor response. The thread eventually included a contributed sketch answering the specific level request -plus my introduction to serial monitor. With the serial monitor, it was then possible to view the photoresistor’s output in numbers, i.e., data. I thought about it. In the meantime I discovered the Arduino IDE plotter. I am sorry I don’t remember where I first read about it. Anyway, I went back to the photoresistor experiment (including serial monitor code) and opened the plotter. It prints a nice graph. I thought it would make a good tutorial in itself. I eliminated the LED response leaving pure numerical data. By copying-and-deleting code from the previous sketch, I arrived at this:
// photoresistor to serial plotter
const int sensorPin = 0;
int lightVal;
void setup()
{
Serial.begin(9600);
}
void loop()
{
lightVal = analogRead(sensorPin);
Serial.println(lightVal);
}
A wiring schematic is a uploaded with this post. That’s a 330 Ω resistor. If you’ve never used the plotter, this is too much fun! In the darkness of a closed project box the plotter prints a “flatline.” With the lid open, the graph wiggles all over the place. If this checks out so far, my question will be about saving data that is just printing to the serial monitor-plotter.