Class: Ev3dev::Sensor
Constant Summary collapse
- PATH =
"/sys/class/lego-sensor"
Instance Attribute Summary
Attributes inherited from Device
Instance Method Summary collapse
-
#initialize(port) ⇒ Sensor
constructor
A new instance of Sensor.
Methods inherited from Device
Constructor Details
#initialize(port) ⇒ Sensor
Returns a new instance of Sensor.
5 6 7 8 9 10 11 12 |
# File 'lib/ev3dev/sensor.rb', line 5 def initialize(port) Dir.glob("#{PATH}/sensor*").each do |path| if IO.read("#{path}/address").strip == "in#{port.to_s}" super path return end end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Ev3dev::Device