You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • For testing your wiring, upload this code. First, it sets pinMode of pin D1. After that - every 100[ms] - it writes to the LED1 the opposite what it reads from pin D1. When the switch is open, then D1 is (weak) pulled up (by internal resistor) and digital read returns 1 (or H/high or true), the opposite written to the LED1 turns it off. When switch is closed (pressed), D1 is pulled to Ground, D1 reads 0 (or L/low or false), and opposite written to LED1 turns it on. Variable iId - interval ID - is there so you can stop the program by entering clearInterval(iId) in the console.

    pinMode(D1,"input_pullup");
    var iId = setInterval(function() {
      LED1.write(!digitalRead(D1));
    }, 100);
    

    2 Attachments

About

Avatar for allObjects @allObjects started