You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Do you have a resistor pulling C1 down to ground as well? That's usually needed, otherwise the signal will just 'float' when the button isn't pressed.

    Espruino has resistors internally that can be used, so all you need to do is to replace your pinMode command with: pinMode(C1, "input_pulldown");.

    Also, I'd remove the pinMode command from onInit and would just execute it normally - Espruino will automatically remember the state of pins when you type save anyway, so there's no need to set them on startup.

About

Avatar for Gordon @Gordon started