Class: Phidgets::LED::LEDOuputs
- Inherits:
-
Object
- Object
- Phidgets::LED::LEDOuputs
- Defined in:
- lib/phidgets-ffi/led.rb
Overview
This class represents an led for a PhidgetLED. All the properties of an led are stored and modified in this class.
Constant Summary collapse
- Klass =
Phidgets::FFI::CPhidgetLED
Instance Method Summary collapse
-
#brightness ⇒ Float
Returns the brightness level of an LED, or raises an error.
-
#brightness=(new_brightness) ⇒ Float
Sets the brightness level of an LED, or raises an error.
-
#current_limit ⇒ Float
Returns the current limit of an LED, or raises an error.
-
#current_limit=(new_current_limit) ⇒ Float
Sets the current limit of an LED, or raises an error.
-
#index ⇒ Integer
Returns the index of the led, or raises an error.
-
#inspect ⇒ Object
Displays data for an led.
Instance Method Details
#brightness ⇒ Float
Returns the brightness level of an LED, or raises an error.
75 76 77 78 79 |
# File 'lib/phidgets-ffi/led.rb', line 75 def brightness ptr = ::FFI::MemoryPointer.new(:double) Klass.getBrightness(@handle, @index, ptr) ptr.get_int(0) end |
#brightness=(new_brightness) ⇒ Float
Sets the brightness level of an LED, or raises an error. Brightness levels range from 0-100
84 85 86 87 |
# File 'lib/phidgets-ffi/led.rb', line 84 def brightness=(new_brightness) Klass.setBrightness(@handle, @index, new_brightness.to_f) new_brightness.to_f end |
#current_limit ⇒ Float
Returns the current limit of an LED, or raises an error.
90 91 92 93 94 |
# File 'lib/phidgets-ffi/led.rb', line 90 def current_limit ptr = ::FFI::MemoryPointer.new(:double) Klass.getCurrentLimitIndexed(@handle, @index, ptr) ptr.get_int(0) end |
#current_limit=(new_current_limit) ⇒ Float
Sets the current limit of an LED, or raises an error. Current Limit levels range from 0-80 mA
99 100 101 102 |
# File 'lib/phidgets-ffi/led.rb', line 99 def current_limit=(new_current_limit) Klass.setCurrentLimitIndexed(@handle, @index, new_current_limit.to_f) new_current_limit.to_f end |
#index ⇒ Integer
Returns the index of the led, or raises an error.
70 71 72 |
# File 'lib/phidgets-ffi/led.rb', line 70 def index @index end |
#inspect ⇒ Object
Displays data for an led.
65 66 67 |
# File 'lib/phidgets-ffi/led.rb', line 65 def inspect "#<#{self.class} @index=#{index}, @brightness=#{brightness}>" end |