/button-api

ESP8266 w/ Espruino runtime sending GET requests to Express server.

Primary LanguageJavaScriptMIT LicenseMIT

Button Press sends GET request to Express Server

This project will connect your controller to wifi, and connect to an Express server running on your computer,

Prerequisites
  1. You will need a supported ESP8266 microcontroller. Preconfigured boards, thus far, are:
  1. Your hardware should be flashed with ThingsSDK Flasher.js using the latest Espruino JS runtime.
  2. You should have ThingsSDK-cli installed.
  3. Other accessories: breadboard, wires, at least one button.
board setup

On a breadboard, connect 3v and ground to the appropriate rails, then connect ground to button, then button to a GPIO pin (except pin 15 on Feather Huzzah, which has a built-in pulldown resistor and needs to be wired to the 3v rail).

deploy

clone this repo, edit the skeleton.config.js to add your local environment information, then run the following:

npm i
npm run configure
thingssdk devices
npm run push

In another terminal, run node api to start the Express Server.

Now, press a button!

known issues
  • if you add debounce to the options object passed to setWatch, the e object passed to the handler function no longer contains the pin property.
known bugs
  • debouncing issues with pins other than 15 on Feather Huzzah. One press can get you multiple API calls.