Class: PhidgetsNative::InterfaceKit
- Inherits:
-
Device
- Object
- Device
- PhidgetsNative::InterfaceKit
- Defined in:
- ext/phidgets_native/interfacekit_ruby.c,
ext/phidgets_native/interfacekit_ruby.c
Overview
This class provides functionality specific to the “InterfaceKit” device class. Primarily, this phidget reports the values of analog and digital inputs, and provides interfaces for outputing to analog and digital components.
Instance Method Summary collapse
-
#change_trigger(Fixnumindex, Fixnumthreshold) ⇒ Fixnum
This method sets the change trigger for the analog sensor at the provided index the specified threshold.
-
#change_triggers ⇒ Array
Returns an array of either ints or nils, which specify the current change_trigger threshold for each analog input sensor.
-
#close ⇒ nil
This method will unregister the phidget event handlers, and free up all API resources associated with the phidget.
-
#data_rate(Fixnumindex, Fixnumrate) ⇒ Fixnum
This method sets the data rate for the analog sensor at the provided index to the rate specified.
-
#data_rates ⇒ Array
Returns an array of either ints or nils, which specify the current data_rate for each analog input sensor.
-
#data_rates_max ⇒ Array
Returns an array of ints which specify the maximum data_rate value that can be configured on each analog input sensor, or nil if the device has yet to be connected.
-
#data_rates_min ⇒ Array
Returns an array of ints which specify the minimum data_rate value that can be configured on each analog input sensor, or nil if the device has yet to be connected.
-
#new(serial_number) ⇒ Object
constructor
All phidget objects are created from the device serial number.
-
#input_count ⇒ Fixnum
Returns an integer which represents the number of digital inputs provided by this interface kit, or nil if the device has yet to be connected.
-
#input_sample_rates ⇒ Array
The interface kit object tracks the sample rate of each input individually.
-
#inputs ⇒ Array
Returns an array of bools, which specify the current digital input states.
-
#output(Fixnum, Boolean) ⇒ Boolean
This method sets the value of the specified digital output at the provided Fixnum offset to the Boolean state (true is on, false is off).
-
#output_count ⇒ Fixnum
Returns an integer which represents the number of digital outputs provided by this interface kit, or nil if the device has yet to be connected.
-
#outputs ⇒ Array
Returns an array of bools, which specify the current digital output states.
-
#ratiometric=(Booleanstate) ⇒ Boolean
Sets the analog sensor voltage reference to ratiometric mode on true, or stable on false.
-
#ratiometric? ⇒ Boolean
Returns true if the analog sensors are currently in ratiometric mode.
-
#sensor_count ⇒ Fixnum
Returns an integer which represents the number of analog inputs provided by this interface kit, or nil if the device has yet to be connected.
-
#sensor_raw(Fixnum) ⇒ Fixnum
This method returns the “raw” value of the sensor at the provided offset.
-
#sensor_sample_rates ⇒ Array
The interface kit object tracks the sample rate of each sensor individually.
-
#sensors ⇒ Array
Returns an array of ints, which specify the current analog sensor states.
Constructor Details
#new(serial_number) ⇒ Object
All phidget objects are created from the device serial number. Serial numbers are required to be Fixnums (aka “unsigned integers”).
Instance Method Details
#change_trigger(Fixnumindex, Fixnumthreshold) ⇒ Fixnum
This method sets the change trigger for the analog sensor at the provided index the specified threshold. This threshould must be between 1 and 1000. The return value is simply what was specified for the rate. Keep in mind that setting a data rate, reverts the data_rate for that input to nil. For more information on how analog inputs are polled, you can read up on the Phidget Analog Input Primer
#change_triggers ⇒ Array
Returns an array of either ints or nils, which specify the current change_trigger threshold for each analog input sensor. A nil indicates that this input is in data_rate mode. If the whole return value is nil, this means that the device hasn’t been connected yet.
#close ⇒ nil
This method will unregister the phidget event handlers, and free up all API resources associated with the phidget. This is an optional, but useful way to remove the object’s overhead before the GC kicks in and actually frees the resource.
#data_rate(Fixnumindex, Fixnumrate) ⇒ Fixnum
This method sets the data rate for the analog sensor at the provided index to the rate specified. This rate must be between data_rate_min and data_rate_max. The return value is simply what was specified for the rate. Keep in mind that setting a data rate, reverts the change_trigger for that input to nil. For more information on how analog inputs are polled, you can read up on the Phidget Analog Input Primer
#data_rates ⇒ Array
Returns an array of either ints or nils, which specify the current data_rate for each analog input sensor. A nil indicates that this input is in change_trigger mode. If the whole return value is nil, this means that the device hasn’t been connected yet.
#data_rates_max ⇒ Array
Returns an array of ints which specify the maximum data_rate value that can be configured on each analog input sensor, or nil if the device has yet to be connected.
#data_rates_min ⇒ Array
Returns an array of ints which specify the minimum data_rate value that can be configured on each analog input sensor, or nil if the device has yet to be connected.
#input_count ⇒ Fixnum
Returns an integer which represents the number of digital inputs provided by this interface kit, or nil if the device has yet to be connected.
#input_sample_rates ⇒ Array
The interface kit object tracks the sample rate of each input individually. This method returns an array containing the sample rates of each digital sensor.
#inputs ⇒ Array
Returns an array of bools, which specify the current digital input states. A return of nil indicates that this device is unplugged
#output(Fixnum, Boolean) ⇒ Boolean
This method sets the value of the specified digital output at the provided Fixnum offset to the Boolean state (true is on, false is off). The return value is simply what was specified for the input state. For more information on output control, you can read up on the CPhidgetInterfaceKit_setOutputState function.
#output_count ⇒ Fixnum
Returns an integer which represents the number of digital outputs provided by this interface kit, or nil if the device has yet to be connected.
#outputs ⇒ Array
Returns an array of bools, which specify the current digital output states. A return of nil indicates that this device is unplugged
#ratiometric=(Booleanstate) ⇒ Boolean
Sets the analog sensor voltage reference to ratiometric mode on true, or stable on false. Read more about this feature in the Analog Inputs Primer
#ratiometric? ⇒ Boolean
Returns true if the analog sensors are currently in ratiometric mode. False if the controller is set to a stable voltage reference. Read more about this feature in the Analog Inputs Primer
#sensor_count ⇒ Fixnum
Returns an integer which represents the number of analog inputs provided by this interface kit, or nil if the device has yet to be connected.
#sensor_raw(Fixnum) ⇒ Fixnum
This method returns the “raw” value of the sensor at the provided offset. For more information on raw sensor values read up on the CPhidgetInterfaceKit_getSensorRawValue function.
#sensor_sample_rates ⇒ Array
The interface kit object tracks the sample rate of each sensor individually. This method returns an array containing the sample rates of each analog sensor.
#sensors ⇒ Array
Returns an array of ints, which specify the current analog sensor states. A return of nil indicates that this device is unplugged