Class: Phidgets::MotorControl::MotorControlAnalogSensors
- Inherits:
-
Object
- Object
- Phidgets::MotorControl::MotorControlAnalogSensors
- Defined in:
- lib/phidgets-ffi/motor_control.rb
Overview
This class represents an analog sensor for a PhidgetMotorControl. All the properties of an analog sensor are stored and modified in this class.
Constant Summary collapse
- Klass =
Phidgets::FFI::CPhidgetMotorControl
Instance Method Summary collapse
-
#index ⇒ Integer
Returns index of the analog input, or raises an error.
-
#inspect ⇒ Object
Displays data for the analog sensor.
-
#raw_value ⇒ Integer
Returns raw value of the analog input, or raises an error.
-
#value ⇒ Integer
(also: #to_i)
Returns value of the analog input, or raises an error.
Instance Method Details
#index ⇒ Integer
Returns index of the analog input, or raises an error.
339 340 341 |
# File 'lib/phidgets-ffi/motor_control.rb', line 339 def index @index end |
#inspect ⇒ Object
Displays data for the analog sensor
334 335 336 |
# File 'lib/phidgets-ffi/motor_control.rb', line 334 def inspect "#<#{self.class} @value=#{value}, @raw_value=#{raw_value}>" end |
#raw_value ⇒ Integer
Returns raw value of the analog input, or raises an error.
352 353 354 355 356 |
# File 'lib/phidgets-ffi/motor_control.rb', line 352 def raw_value ptr = ::FFI::MemoryPointer.new(:int) Klass.getSensorRawValue(@handle, @index, ptr) ptr.get_int(0) end |
#value ⇒ Integer Also known as: to_i
Returns value of the analog input, or raises an error.
344 345 346 347 348 |
# File 'lib/phidgets-ffi/motor_control.rb', line 344 def value ptr = ::FFI::MemoryPointer.new(:int) Klass.getSensorValue(@handle, @index, ptr) ptr.get_int(0) end |