Add two shortcuts to turn all on/off.

This commit is contained in:
Aaron Mueller 2014-06-23 23:38:38 +02:00
parent e07d8124e1
commit f1eeca1dde

View file

@ -10,5 +10,15 @@ abort unless File.exists?('/dev/ttyUSB0')
# Create the serial connection and send the given command. # Create the serial connection and send the given command.
SerialPort.open('/dev/ttyUSB0', 9600, 8, 1, SerialPort::NONE) do |s| SerialPort.open('/dev/ttyUSB0', 9600, 8, 1, SerialPort::NONE) do |s|
s.puts(ARGV.join(' ')) command = ARGV.join(' ')
if command == 'on' or command == 'off'
puts 'all ' + command + '...'
['a', 'c', 'c', 'd'].each do |port|
s.puts(command + ' ' + port)
end
s.puts('led ' + command)
else
s.puts(ARGV.join(' '))
end
end end