turn on/off the Lamp in DeltaS112 with RocketIO::Linda and Relay on Arduino
- https://github.com/masuilab/linda-delta-lamp
- watch tuple ["lamp", "on"] and turn on the lamp
- watch tuple ["lamp", "off"] and turn off the lamp
- then write tuple ["lamp", "on", "success"]
- Arduino Firmata
- Ruby 1.8.7 ~ 2.0.0
- LindaBase
Install Rubygems
% gem install bundler foreman
% bundle install
Install Arduino Firmata v2.2
Arduino IDE -> [File] -> [Examples] -> [Firmata] -> [StandardFirmata]
relay -> digital pin 12
set ENV var "LINDA_BASE", "LINDA_SPACE" and "ARDUINO"
% export ARDUINO=/dev/tty.usb-device-name
% export LINDA_BASE=http://linda.example.com
% export LINDA_SPACE=test
% bundle exec ruby linda-delta-lamp.rb
oneline
% LINDA_BASE=http://linda.example.com LINDA_SPACE=test bundle exec ruby linda-delta-lamp.rb
for launchd (Mac OSX)
% sudo foreman export launchd /Library/LaunchDaemons/ --app linda-delta-lamp -u `whoami`
% sudo launchctl load -w /Library/LaunchDaemons/linda-delta-lamp-main-1.plist
for upstart (Ubuntu)
% sudo foreman export upstart /etc/init/ --app linda-delta-lamp -d `pwd` -u `whoami`
% sudo service linda-delta-lamp start