Skip to content
Browse files

Fix examples to match new sensor behaviour

  • Loading branch information...
1 parent 61d29b1 commit 012b26ded3a190856a0a92756c188b64f608d56f @pcasaretto committed Feb 22, 2013
Showing with 4 additions and 10 deletions.
  1. +1 −3 examples/potentiometer/potentiometer.rb
  2. +1 −3 examples/rgb_led/rgb_led.rb
  3. +2 −4 examples/sensor/sensor.rb
View
4 examples/potentiometer/potentiometer.rb
@@ -13,12 +13,10 @@
delay = 500.0
-set_delay = Proc.new do |data|
+potentiometer.when_data_received do |data|
puts "DATA: #{delay = data.to_i}"
end
-potentiometer.when_data_received(set_delay)
-
[:on, :off].cycle do |switch|
puts "DELAY: #{seconds = (delay / 1000.0)}"
led.send(switch)
View
4 examples/rgb_led/rgb_led.rb
@@ -12,13 +12,11 @@
delay = 500.0
-set_delay = Proc.new do |data|
+potentiometer.when_data_received do |data|
sleep 0.5
puts "DATA: #{delay = data.to_i}"
end
-potentiometer.when_data_received(set_delay)
-
sleep(2)
loop do
puts "DELAY: #{seconds = (delay / 1000.0)}"
View
6 examples/sensor/sensor.rb
@@ -10,10 +10,8 @@
board = Dino::Board.new(Dino::TxRx.new)
sensor = Dino::Components::Sensor.new(pin: 'A0', board: board)
-on_data = Proc.new do |data|
- puts data
+sensor.when_data_received do |data|
+ puts data
end
-sensor.when_data_received(on_data)
-
sleep

0 comments on commit 012b26d

Please sign in to comment.
Something went wrong with that request. Please try again.