I cant find much about using a flags that i can understand with my feeble machinist brain. If anyone feels kind enough to edit this to work for me id be really grateful. it might even make sense to me once i see it in the context a [program i understand.
Thanks
const int buttonPin = 3;
const int ledPin = 2;
int buttonState = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
} else {
digitalWrite(ledPin, LOW);
}
}