the ESP8266 HW / Espruino Firmware build for the ESP8266 HW does not have a button / BTN the way the different Espruino HW / boards have. You have to add externally a button on a GPIO pin that is free / available and code against that pin. Instead of using BTN, you use the GPIO pin identifier.
If you really want to use BTN, you just make an assignment as first thing in the kind of var BTN = <GPIOPINIdentifier>; (and - for good style - add also setting the pinMode() (see http://www.espruino.com/Reference#l__global_pinMode).
var BTN = <GPIOPINIdentifier>;
For adding external buttons, see: https://www.espruino.com/Pico+Buttons (ESP8266 GPIO Pin may not have a internal pull-up/pull-down feature nor a resistor on the board and connected to the pin you intent to use, therefore you may also have to add a resistor to pull the pin either up or down - depending to which rail you connect the button.
© Espruino, powered by microcosm.
Report a problem