Method: Ws2812::Basic#open
- Defined in:
- lib/ws2812/basic.rb
#open ⇒ Object
Actually opens (initializes) communication with the LED strand
Raises an exception when the initialization fails.
Failure is usually because you don’t have root permissions which are needed to access /dev/mem and to create special devices.
77 78 79 80 81 82 83 |
# File 'lib/ws2812/basic.rb', line 77 def open return nil if @open resp = ws2811_init(@leds) fail "init failed with code: " + resp.to_s + ", perhaps you need to run as root?" unless resp.zero? @open = true self end |