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.

    var iId = setInterval(function() {
    }, 100);

    2 Attachments


Avatar for allObjects @allObjects started