Last active
August 29, 2015 14:00
-
-
Save schappim/166aca330c88223de709 to your computer and use it in GitHub Desktop.
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
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'w1temp' | |
| require 'artoo' | |
| require 'httparty' | |
| sensor = Temperature.new | |
| host = `ifconfig | grep -i Bcast`.split(' ')[5].split(':').last | |
| api :host => host, :port => '4321' | |
| connection :raspi, :adaptor => :raspi | |
| device :led, :driver => :led, :pin => 15 | |
| work do | |
| every 1.second do | |
| led.toggle | |
| @result = HTTParty.post("http://littlebirdiot.herokuapp.com/update", | |
| :body => { :sensor => sensor.name, | |
| :reading => sensor.reading} | |
| ) | |
| puts sensor.name | |
| puts sensor.reading | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment