board (like Raspberry Pi), with multiple pinouts, running on an ARM processor. Regular Debian/Ubuntu Linux OS. Language (HW control): BoneScript A Node.js plugin developed especially for boards like BBB which provides a JS interface to turn current to the pins of a BBB on or off (or read the current for input PINS). BoneScript is similar to the Arduino language.
REST If we directly access a webpage hosted on the BBB, we can use socket.io, or we can create a RESTful API on the BBB. Language (UI): AngularJS We can use any MVC or pure JS too. This is the frontend for the given REST API on the BBB to control the states of the switches.
the PINS of the BBB Create a webpage on the BBB Make buttons on the page. Each button calls a digitalWrite function corresponding to connected LEDs. On page load read PIN states and updates button accordingly. Red color for off, Green for on (or something similar). Connect the BBB to WLAN/Internet. Access IP of BBB from Laptop/Mobile, click the buttons and watch the LEDs go ON and OFF. *** Make a video, or show live demo of this if WiFi available ***
particular webpage on the particular IP. Who remembers URLs and IPs ? No App for mobile, have to do via browser. Clients cannot be built for devices that do not have JS support.
API using Node.js and Express 4. var express = require('express'); var app = express(); app.get('/switch/fan/:state', function(req, res) { if (req.params.state === 1) // digitalWrite high to the required PIN else // digitalWrite low to the required PIN }); app.listen(8080);
client to turn the fan off or on http://bbb.ip/switch/fan/0 -- **to turn off the fan** http://bbb.ip/switch/fan/1 -- ** to turn on the fan** Now we can make whatever client we want (MVC client app, or Android/iOS app, or even a command line based noGUI app).