Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int led1 = 13;
- int PBPU = 2; button that uses the INPUT_PULLUP
- PBPD int = 3; button that uses the INPUT_PULLDOWN
- void setup () {
- pinMode (led1, OUTPUT);
- pinMode (PBPU, INPUT_PULLUP);
- pinMode (PBPD, INPUT); }
- void loop () {
- int BtnPU = digitalRead (PBPU);
- int BtnPD = digitalRead (the PBPD);
- If (BtnPU == LOW) {//when the button is pressed PULLUP
- digitalWrite (led1, HIGH); }
- If (BtnPD == HIGH) {//when the PULLDOWN button pressed
- digitalWrite (led1, LOW);} }
Advertisement
Add Comment
Please, Sign In to add comment