Hi,
how can I restrict that Serial.print(); goes to serial just once?
For example, let me explain on this part of 'button code'-
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
[color=red] [b]Serial.println("HIGH");[/b][/color]
delay(50);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}}
So, if I press button, LED goes ON, but on serial I will get message HIGH in new lines every 50ms.
What would I like to get is that while button is pressed, LED goes HIGH but Serial prints 'HIGH' just once instead of constantly printing while I'm holding button.
I hope you will understand me