Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Pin =8;
- int ledPin = 13;
- boolean lastButton = LOW;
- boolean ledOn = false;
- void setup()
- {
- pinMode(Pin, INPUT);
- pinMode(ledPin, OUTPUT);
- }
- void loop()
- {
- if (digitalRead(Pin) == HIGH && lastButton == LOW)
- {
- ledOn = !ledOn;
- delay(2000);
- lastButton - HIGH;
- }
- else
- {
- lastButton = digitalRead(Pin);
- }
- digitalWrite(ledPin, ledOn);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement