emori/emori.rb

14 lines
487 B
Ruby
Executable file

#!/usr/bin/env ruby
require 'rubygems'
require 'serialport'
# 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.
SerialPort.open('/dev/ttyUSB0', 9600, 8, 1, SerialPort::NONE) do |s|
s.puts(ARGV.join(' '))
end