This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
method: 'POST', | |
path: '/dostuff', | |
config: { | |
auth: false, | |
cors: { | |
additionalHeaders: ['accept'] | |
}, | |
handler: handleStuff | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net'); | |
var five = require('johnny-five'); | |
var options = { | |
host: 'localhost', //any tcp host | |
port: 3001 // any port | |
}; | |
var client = net.connect(options); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SerialPort = require('serialport').SerialPort; | |
var bindPhysical = require('mqtt-serial').bindPhysical; | |
var mqtt = require('mqtt'); | |
// might be something like COM1 on windows | |
var SERIAL_PORT = process.env.SERIAL_PORT || '/dev/tty.usbmodem1421'; | |
var serialPort = new SerialPort(SERIAL_PORT,{ | |
baudrate: 57600, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net'); | |
var SerialPort = require('serialport').SerialPort; | |
//possibly something like COM1 on windows | |
var SERIAL_PORT = process.env.SERIAL_PORT || '/dev/tty.usbmodem1421'; | |
var PORT = process.env.PORT || 3001; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net'); | |
var five = require('johnny-five'); | |
var firmata = require('firmata'); | |
var options = { | |
host: '192.168.2.5', //whatever host | |
port: 48879 //some port | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require('net'); | |
var five = require('johnny-five'); | |
var firmata = require('firmata'); | |
var client = net.connect({port: 8124}, function() { //'connect' listener | |
console.log('connected to server!'); | |
console.log('connected to server event!'); | |
var io = new firmata.Board(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pi@raspberrypi ~/rpt $ npm install raspi-io | |
npm WARN package.json [email protected] No description | |
npm WARN package.json [email protected] No repository field. | |
npm WARN package.json [email protected] No README data | |
- | |
> [email protected] install /home/pi/rpt/node_modules/raspi-io/node_modules/raspi-core/node_modules/raspi-wiringpi | |
> sh install-wiringpi.sh | |
Wiring Pi is already installed, skipping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msg.subdevice = 'lx'; | |
msg.payload = { | |
setState: { | |
hue: 65000, | |
sat: 0xffff, | |
white: 5000, | |
lum: 0x8000 | |
} | |
}; | |
return msg; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msg.uuid = 'gateway uuid'; | |
msg.token = 'gateway token'; | |
msg.alternateMethod = 'gatewayConfig'; | |
msg.method = 'createSubdevice'; | |
//msg.method = 'getDefaultOptions'; | |
msg.name = 'aj'; | |
msg.type = 'skynet-alljoyn'; | |
msg.options = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msg.payload = { | |
setState: { | |
hue: 0xcc15, | |
sat: 0xffff, | |
white: 5000, | |
lum: 0x8000, | |
bulbName: 'bulby' | |
} | |
}; |