Last active
January 25, 2022 19:10
-
-
Save stiplady/e1d5e98067b324fad15c8298bf983856 to your computer and use it in GitHub Desktop.
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 ledPin = 13; // Output connected to digital pin 13 | |
| int inPin = 7; // input connected to digital pin 7 | |
| int pinState = LOW; | |
| void setup() { | |
| pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output | |
| pinMode(inPin, INPUT); // sets the digital pin 7 as input | |
| digitalWrite(ledPin, LOW); | |
| } | |
| void loop() { | |
| if ( HIGH == digitalRead(inPin) ) { | |
| digitalWrite(ledPin, HIGH); // sets the output high (on) | |
| delay(5000); // 5 seconds | |
| digitalWrite(ledPin, LOW); // sets output low (off) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment