Add two shortcuts to turn all on/off.
This commit is contained in:
parent
e07d8124e1
commit
f1eeca1dde
1 changed files with 11 additions and 1 deletions
10
emori.rb
10
emori.rb
|
@ -10,5 +10,15 @@ 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|
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue