Skip to content

Instantly share code, notes, and snippets.

@ayr-ton
Last active April 4, 2016 23:51
Show Gist options
  • Save ayr-ton/8731331ea64583b0b3fc to your computer and use it in GitHub Desktop.
Save ayr-ton/8731331ea64583b0b3fc to your computer and use it in GitHub Desktop.
Blinking lights
SUBSYSTEM=="usb", ATTR{idVendor}=="1130", ATTR{idProduct}=="0001", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="2c0d", ATTR{idProduct}=="0001", GROUP="plugdev"
api = require 'simple-api'
blync = require 'blync'
device = blync.getDevice 0
v0 = new api
prefix: ["api", "v0"]
host: "0.0.0.0"
port: "3333"
logLevel: 0
v0.Controller "light",
options: {}
routes:
setState:
method: "GET"
path: ["*state"]
actions:
setState: (req, res, params) ->
device.setColor params.state
@responses.respond res
blync = require 'blync'
device = blync.getDevice 0
process.argv.forEach (val, index, array) ->
if index == 2
device.setColor val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment