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