Class: Phidgets::LED
Overview
This class represents a PhidgetLED.
Defined Under Namespace
Classes: LEDOuputs
Constant Summary collapse
- Klass =
Phidgets::FFI::CPhidgetLED
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
The attributes of a PhidgetLED.
-
#leds ⇒ LEDOuputs
readonly
Collection of LEDs.
Instance Method Summary collapse
-
#current_limit ⇒ Phidgets::FFI::LEDCurrentLimit
Returns the board current limit for all LEDs, or raises an error.
-
#current_limit=(new_current_limit) ⇒ Phidgets::FFI::LEDCurrentLimit
Sets the board current limit for all LEDs, or raises an error.
-
#voltage ⇒ Phidgets::FFI::LEDVoltage
Returns the voltage level for all LEDs, or raises an error.
-
#voltage=(new_voltage) ⇒ Phidgets::FFI::LEDVoltage
Sets the voltage level for all LEDs, or raises an error.
Methods included from Common
#attached?, #attached_to_server?, attributes, #close, #detached?, #detached_to_server?, device_class, #device_class, device_id, #id, #initialize, #label, #label=, #name, #on_attach, #on_detach, #on_error, #on_server_connect, #on_server_disconnect, #on_sleep, #on_wake, #serial_number, #server_address, server_address, #server_id, server_id, server_status, #type, #version, #wait_for_attachment
Instance Attribute Details
#attributes ⇒ Object (readonly)
The attributes of a PhidgetLED
16 17 18 |
# File 'lib/phidgets-ffi/led.rb', line 16 def attributes @attributes end |
#leds ⇒ LEDOuputs (readonly)
Collection of LEDs
11 12 13 |
# File 'lib/phidgets-ffi/led.rb', line 11 def leds @leds end |
Instance Method Details
#current_limit ⇒ Phidgets::FFI::LEDCurrentLimit
Returns the board current limit for all LEDs, or raises an error. Not supported on all PhidgetLEDs.
23 24 25 26 27 |
# File 'lib/phidgets-ffi/led.rb', line 23 def current_limit ptr = ::FFI::MemoryPointer.new(:int) Klass.getCurrentLimit(@handle, ptr) Phidgets::FFI::LEDCurrentLimit[ptr.get_int(0)] end |
#current_limit=(new_current_limit) ⇒ Phidgets::FFI::LEDCurrentLimit
Sets the board current limit for all LEDs, or raises an error. Not supported on all PhidgetLEDs.
32 33 34 35 36 |
# File 'lib/phidgets-ffi/led.rb', line 32 def current_limit=(new_current_limit) ptr = ::FFI::MemoryPointer.new(:int) Klass.setCurrentLimit(@handle, Phidgets::FFI::LEDCurrentLimit[new_current_limit]) new_current_limit end |
#voltage ⇒ Phidgets::FFI::LEDVoltage
Returns the voltage level for all LEDs, or raises an error. Not supported on all PhidgetLEDs.
39 40 41 42 43 |
# File 'lib/phidgets-ffi/led.rb', line 39 def voltage ptr = ::FFI::MemoryPointer.new(:int) Klass.getVoltage(@handle, ptr) Phidgets::FFI::LEDVoltage[ptr.get_int(0)] end |
#voltage=(new_voltage) ⇒ Phidgets::FFI::LEDVoltage
Sets the voltage level for all LEDs, or raises an error. Not supported on all PhidgetLEDs.
48 49 50 51 52 |
# File 'lib/phidgets-ffi/led.rb', line 48 def voltage=(new_voltage) ptr = ::FFI::MemoryPointer.new(:int) Klass.setVoltage(@handle, Phidgets::FFI::LEDVoltage[new_voltage]) new_voltage end |