-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Augusto Ciuffoletti
committed
Oct 12, 2016
1 parent
76d11ae
commit c73c767
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'logger' | ||
require './aggregator' | ||
require './secret' | ||
|
||
logger = Logger.new(STDOUT) | ||
logger.level = Logger::DEBUG | ||
|
||
channel={} | ||
channel["channel1"]=Queue.new | ||
channel["channel2"]=Queue.new | ||
|
||
mixins = { | ||
'NTCtoDegrees' => { | ||
ntc_in: channel["channel1"], | ||
degrees_out: channel["channel2"], | ||
gain: 16, | ||
period: 30 | ||
}, | ||
'NTC' => { | ||
level_out: channel["channel1"], | ||
period:1, | ||
uri: 'ws://192.168.113.177' | ||
}, | ||
'ThingSpeak' => { | ||
value_in: channel["channel2"], | ||
field: 'field1', | ||
uri: 'http://api.thingspeak.com/update.json', | ||
writekey: $secret[:writekey] | ||
} | ||
} | ||
|
||
temp=Thread.new { | ||
begin | ||
Aggregator.new(mixins,logger).run() | ||
rescue Exception => e | ||
logger.fatal "Aggregator thread failed to spawn: #{e.inspect}" | ||
exit | ||
end | ||
} | ||
|
||
temp.join |