2014-06-11 22:40:23 +02:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require 'rubygems'
|
|
|
|
require 'serialport'
|
|
|
|
|
2014-06-23 23:28:29 +02:00
|
|
|
# If the main monitor is off, the Arduino is also off because it is connected to
|
|
|
|
# the USB hub inside the monitor. So, if the main monitor is off, the user can't
|
|
|
|
# control the lights any more and the LED stripes are off too.
|
|
|
|
abort unless File.exists?('/dev/ttyUSB0')
|
|
|
|
|
|
|
|
# Create the serial connection and send the given command.
|
2014-06-11 22:40:23 +02:00
|
|
|
SerialPort.open('/dev/ttyUSB0', 9600, 8, 1, SerialPort::NONE) do |s|
|
2014-06-29 15:36:47 +02:00
|
|
|
s.puts(ARGV.join(' '))
|
2014-06-11 22:40:23 +02:00
|
|
|
end
|