Class: Phidgets::Accelerometer::AccelerometerAxes
- Inherits:
-
Object
- Object
- Phidgets::Accelerometer::AccelerometerAxes
- Defined in:
- lib/phidgets-ffi/accelerometer.rb
Overview
This class represents an axis of acceleration for a PhidgetAccelerometer. All the properties of an accelerometer axis are stored and modified in this class.
Constant Summary collapse
- Klass =
Phidgets::FFI::CPhidgetAccelerometer
Instance Method Summary collapse
-
#acceleration ⇒ Float
Returns the acceleration value of the axis, or raises an error.
-
#acceleration_max ⇒ Float
Returns the largest acceleration value that the axis will return, or raises an error.
-
#acceleration_min ⇒ Float
Returns the largest(negative) acceleration value that the axis will return, or raises an error.
-
#index ⇒ Integer
Returns index of the axis, or raises an error.
-
#inspect ⇒ Object
Displays data for the axis.
-
#sensitivity ⇒ Float
Returns sensitivity of the acceleration data for the axis, or raises an error.
-
#sensitivity=(new_sensitivity) ⇒ Float
Sets the sensitivity of the acceleration data for the axis, or raises an error.
Instance Method Details
#acceleration ⇒ Float
Returns the acceleration value of the axis, or raises an error.
83 84 85 86 87 |
# File 'lib/phidgets-ffi/accelerometer.rb', line 83 def acceleration ptr = ::FFI::MemoryPointer.new(:double) Klass.getAcceleration(@handle, @index, ptr) ptr.get_double(0) end |
#acceleration_max ⇒ Float
Returns the largest acceleration value that the axis will return, or raises an error.
90 91 92 93 94 |
# File 'lib/phidgets-ffi/accelerometer.rb', line 90 def acceleration_max ptr = ::FFI::MemoryPointer.new(:double) Klass.getAccelerationMax(@handle, @index, ptr) ptr.get_double(0) end |
#acceleration_min ⇒ Float
Returns the largest(negative) acceleration value that the axis will return, or raises an error.
97 98 99 100 101 |
# File 'lib/phidgets-ffi/accelerometer.rb', line 97 def acceleration_min ptr = ::FFI::MemoryPointer.new(:double) Klass.getAccelerationMin(@handle, @index, ptr) ptr.get_double(0) end |
#index ⇒ Integer
Returns index of the axis, or raises an error.
78 79 80 |
# File 'lib/phidgets-ffi/accelerometer.rb', line 78 def index @index end |
#inspect ⇒ Object
Displays data for the axis
73 74 75 |
# File 'lib/phidgets-ffi/accelerometer.rb', line 73 def inspect "#<#{self.class} @acceleration=#{acceleration}, @acceleration_max=#{acceleration_max}, @acceleration_min=#{acceleration_min}, @sensitivity=#{sensitivity}>" end |
#sensitivity ⇒ Float
Returns sensitivity of the acceleration data for the axis, or raises an error.
112 113 114 115 116 |
# File 'lib/phidgets-ffi/accelerometer.rb', line 112 def sensitivity ptr = ::FFI::MemoryPointer.new(:double) Klass.getAccelerationChangeTrigger(@handle, @index, ptr) ptr.get_double(0) end |
#sensitivity=(new_sensitivity) ⇒ Float
Sets the sensitivity of the acceleration data for the axis, or raises an error.
106 107 108 109 |
# File 'lib/phidgets-ffi/accelerometer.rb', line 106 def sensitivity=(new_sensitivity) Klass.setAccelerationChangeTrigger(@handle, @index, new_sensitivity.to_f) new_sensitivity.to_f end |