Git Product home page Git Product logo

buttonthing's Introduction

buttonthing

An ESP8266-based hardware button thing to send commands to my Lights app.

Although the Lights app can be controlled from pretty much any WebKit browser, I wanted to be able to turn on/off lights without having to mess with my phone or laptop. I'm using the Adafruit HUZZAH ESP8266 Breakout to connect to my WiFi network to send commands to my Lights server. The wiring is pretty simple as seen in this Fritzing diagram:

buttonthing Fritzing layout (the fritzing file is included in the project - buttonthing.fzz)

It's pretty straightforward to adjust the endpoints it calls on the Lights server - just update the '/lights/...' URI in the block associated with the desired button. For example, Button1 currently calls medtog.php as shown:

const int button1 = 14;
const char* url1 = "/lights/medtog.php";
int button1State = 0;

To compile and upload the code, I use Visual Studio Code with the PlatformIO extension installed. Adafruit's tutorial on the ESP8266 breakout is useful, but be aware - it hasn't been updated to address VSC, and describes programming it with the Arduino IDE instead. Much of the same information applies, only it's easier to use VSC/PIO - the necessary libraries for the 8266 are already included. In my experience, VSC/PIO will program the thing "out of the box" - no hardware configuration needed if the correct board is selected/configured in platformio.ini (as seen in this project).

(11-Dec-2019: I don't think led2(GPIO16) is actually being used for anything. I dimly remember having it there to indicate something, but what exactly has been lost to the sands of time and untracked code revisions. I'll get it out of there soon.)

06-Jan-2021: Apparently, by "soon", nearly 13 months. Oh well. Finally got 'round to removing led2 on GPIO16, 'cos I wanted to add a seventh button to call goodmorning.php from Lights. Turns out, GPIO16 has an internal pull-down, which doesn't suit my needs, and the vagaries of GPIO15 being used for uploads prevents that playing nicely here. I'll have to do some research (maybe do an external pull-up on 16?).

buttonthing's People

Contributors

kenkl avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.