Tessel Webserver Demo
This is a demonstration of using both a routing library (
tiny-router) to field HTTP requests as well as a websocket connection (using
nodejs-websocket) to a client. This is useful when you want to display an interface to a client and have that client manipulate the state of Tessel.
The HTML provided buttons for toggling the LEDs and the websocket will toggle
led0 every five seconds by default.
Connect your tessel to wifi:
tessel wifi -n YOUR_SSID -p YOUR_PASSWORD
Your Tessel will print its IP address to the console. If you didn't see it, run:
tessel wifi -l
Once you have your IP Address, open up
/static/index.html and insert your IP Address in the websocket creation method.
Running the example
tessel run app.js
Then go to the IP address of your Tessel (followed by the port) in your web browser (for example
What you can do
If you click any of the buttons in the loaded website, Tessel's LEDs will toggle. Additionally, the websocket will automatically toggle
led0 every five seconds.
I've noticed that using both websockets and HTTP on Tessel makes it less reliable. I usually have to reset it after each successful push in order to receive another HTTP request. We're working on it!