From f1eeca1dde0fad12240a67d922de9a0d2dab090d Mon Sep 17 00:00:00 2001 From: Aaron Mueller Date: Mon, 23 Jun 2014 23:38:38 +0200 Subject: [PATCH] Add two shortcuts to turn all on/off. --- emori.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/emori.rb b/emori.rb index 918018b..a1e2146 100755 --- a/emori.rb +++ b/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| - 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