Class: Dino::Components::Sensor
Instance Attribute Summary
#board, #pin, #pullup
Instance Method Summary
collapse
#initialize
Instance Method Details
#after_initialize(options = {}) ⇒ Object
4
5
6
7
8
|
# File 'lib/dino/components/sensor.rb', line 4
def after_initialize(options={})
@data_callbacks = []
@board.add_analog_hardware(self)
@board.start_read
end
|
#update(data) ⇒ Object
14
15
16
17
18
|
# File 'lib/dino/components/sensor.rb', line 14
def update(data)
@data_callbacks.each do |callback|
callback.call(data)
end
end
|
#when_data_received(&block) ⇒ Object
10
11
12
|
# File 'lib/dino/components/sensor.rb', line 10
def when_data_received(&block)
@data_callbacks << block
end
|