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 ⇒ Integer
Returns the brightness level of an LED, or raises an error.
-
#brightness=(new_brightness) ⇒ Integer
Sets the brightness level of an LED, or raises an error.
-
#index ⇒ Integer
Returns the index of the servo motor, or raises an error.
-
#inspect ⇒ Object
Displays data for an led.
Instance Method Details
#brightness ⇒ Integer
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(:int) Klass.getDiscreteLED(@handle, @index, ptr) ptr.get_int(0) end |
#brightness=(new_brightness) ⇒ Integer
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.setDiscreteLED(@handle, @index, new_brightness.to_i) new_brightness.to_i end |
#index ⇒ Integer
Returns the index of the servo motor, 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 |