
There's only a slight alteration to the software in Task 38.
Just means declaring a counter variable & incrementing it whenever the button is pushed & a reading is to be outputted.
You can see (readings 9-18) where i put my finger over the photocell, & later (27-31) where i just cupped the photocell in my hand..
/* check if the pushbutton is pressed.
if it is, the buttonState is HIGH, so..*/
if (buttonState == HIGH)
{
//..increment the reading counter &..
readNum++;
//..output the LDR reading to the SM
Serial.print("Reading number ");
Serial.print(readNum); // reading count
Serial.print(" is ");
Serial.println(photocellReading); // the raw analog reading
delay(100); // debounce delay
}// if..
This stuff isn't hard..
ReplyDelete