Skip to content

Instantly share code, notes, and snippets.

@dexterlabora
dexterlabora / server.js
Last active September 28, 2015 09:43
Server to provide a web API and socket interface for controlling Arduino circuits.
// server.js
// This program creates the server for controlling Arduino or similar projects.
// You can either use a web socket for real-time communication, or GET requests to send commands easily.
// Refer to the following "elevator.js" file for a working circuit file that accepts the commands.
// https://gist.github.com/dexterlabora/4a4692d0954eab107dd2
// More info at www.internetoflego.com
// includes
var Primus = require('primus');
@dexterlabora
dexterlabora / energysave.js
Created September 21, 2015 20:02
Save energy by detecting motion to turn on lights and then turning them off after 5 minutes of inactivity.
// energysave.js
// www.internetoflego.com
// Dependencies
var five = require("johnny-five");
var board = new five.Board();
// Arduino board connection
board.on("ready", function() {
@dexterlabora
dexterlabora / citystation.js
Last active October 6, 2015 14:38
This NodeJS program uses the Linux LIRC driver to control Lego infrared Power Functions
// citystation.js
// Dependencies
var five = require('johnny-five');
var raspi = require("raspi-io");
var board = new five.Board({
io: new raspi()
});
// traincrossing.js
// Dependencies
var five = require("johnny-five");
var board = new five.Board();
// Arduino board connection
board.on("ready", function() {
// Train Crossing Components
@dexterlabora
dexterlabora / trackswitch.js
Created September 17, 2015 15:05
IoL - Lego Track Switch - Servo and LEDs
//trackswitch.js
var five = require("johnny-five");
var board = new five.Board();
//Arduino board connection
board.on("ready", function() {
@dexterlabora
dexterlabora / trafficsignal.js
Created September 17, 2015 15:01
IoL - Traffic Signal - LED Sequence
//trafficsignal.js
var five = require("johnny-five");
var board = new five.Board();
//Arduino board connection
board.on("ready", function() {