This gist was automatically pasted at the request of the code author or one of the discord server helpers. If you have any suggestions or bugs to report, you can do so on our GitHub repository, or in our discord server. This project is run by volunteers so feel free to fork and commit your changes then open a pull request!
Created
January 8, 2021 06:48
-
-
Save ArduinoDiscordBot/c0d6d5440e1708869d4df8aa89770bce to your computer and use it in GitHub Desktop.
Code by xert13#5006 - Fri Jan 08 2021 06:48:35 GMT+0000 (Coordinated Universal Time)
This file contains 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
Toggle Button | |
int button = 2; | |
int led = 13; | |
int status = false; | |
void setup(){ | |
pinMode(led, OUTPUT); | |
pinMode(button, INPUT_PULLUP); | |
} | |
void loop(){ | |
if (digitalRead(button) == true) { | |
status = !status; | |
digitalWrite(led, status); | |
} while(digitalRead(button) == true); | |
delay(50); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment