Line | |
---|
1 | #!/usr/bin/env ruby
|
---|
2 | #
|
---|
3 | # Author: Norbert Wigbels - foobla.wigbels.de/uber-foobla
|
---|
4 | #
|
---|
5 | # HotHotPiper continously reads the status of a
|
---|
6 | # reed contact attached to the Raspberry Pi GPIO
|
---|
7 | #
|
---|
8 | # The reed measures gas usage.
|
---|
9 | #
|
---|
10 | # A magig URL is formed and called; the url
|
---|
11 | # stores the sensor-data to wigbels.net
|
---|
12 | #
|
---|
13 | # todo: status-led
|
---|
14 | #
|
---|
15 |
|
---|
16 | #------------------------------------------
|
---|
17 | # Tainted mode 0-4
|
---|
18 | $SAFE=0
|
---|
19 |
|
---|
20 |
|
---|
21 | #------------------------------------------
|
---|
22 | require 'net/http'
|
---|
23 | require 'pi_piper'
|
---|
24 |
|
---|
25 | include PiPiper
|
---|
26 |
|
---|
27 |
|
---|
28 | watch :pin => 4, :trigger => :falling do
|
---|
29 | puts('added 100 liter of gas to sensor-database')
|
---|
30 | Net::HTTP.get(URI.parse('http://www.wigbels.net/cgi-bin/hhw.rb?sensorid=1&data=10'))
|
---|
31 | end
|
---|
32 |
|
---|
33 | PiPiper.wait
|
---|
Note:
See
TracBrowser
for help on using the repository browser.