Created
February 1, 2019 18:21
-
-
Save glyons/37e41340645db518e618ffa7c86e9231 to your computer and use it in GitHub Desktop.
Digispark 1 second delay button with on board LED
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int led =1 ; // Ues on board LED | |
| int button=2; // Button to 5V Rail and 10k register on P2 to GND | |
| int status = false; | |
| void setup() { | |
| digitalWrite(led, LOW); | |
| pinMode(led, OUTPUT); | |
| digitalWrite(button,LOW); | |
| pinMode(button,INPUT); | |
| } | |
| void loop() { | |
| if (digitalRead(button) == HIGH) { | |
| status = !status; | |
| delay(1000); | |
| digitalWrite(led, status); | |
| } while(digitalRead(button) == LOW); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment