else if
(command == "eight")
-
else if
(command == "nine")
40
else if
(command == "up")
-
else if
(command == "left")
-
else if
(command == "right")
-
else if
(command == "down")
-
else if
(command == "ret")
45
else if
(command == "exit")
-
else if
(command == "a")
-
else if
(command == "b")
-
else if
(command == "c")
-
else if
(command == "d")
50
else if
(command == "txt")
-
else if
(command == "pip")
-
else if
(command == "pre_ch")
-
else if
(command == "search")
-
else if
(command == "vol_up")
55
else if
(command == "vol_down")
-
else if
(command == "dual")
-
else if
(command == "usb_hub")
-
else if
(command == "mute")
-
else if
(command == "p_size")
60
else if
(command == "ch_list")
-
else if
(command == "subtitle")
-
else if
(command == "prog_up")
-
else if
(command == "prog_down") tv.prog_down();
-
else if
(command == "pause")
65
else if
(command == "rewind")
-
else if
(command == "forward")
-
else if
(command == "menu")
-
else if
(command == "smart_tv")
-
else if
(command == "record")
70
else if
(command == "play")
-
else if
(command == "stop")
-
else
Serial.println("Command is
-
-
command = "";
75
input_available = false;
-
}
-
}
-
In lines 3 to 5, we define a global
command
that holds the current command, and a Boolean flag named
input_available
that is true when the sketch has received a new command. As
usual, we initialize the serial port in the
The Arduino calls the
arrives at the serial port. (Learn more about
Using Various Languages, on page
tv.eight();
tv.nine();
tv.up();
tv.left();
tv.right();
tv.down();
tv.ret();
tv.exit();
tv.a();
tv.b();
tv.c();
tv.d();
tv.txt();
tv.pip();
tv.pre_ch();
tv.search();
tv.vol_up();
tv.vol_down();
tv.dual();
tv.usb_hub();
tv.mute();
tv.p_size();
tv.ch_list();
tv.subtitle();
tv.prog_up();
tv.pause();
tv.rewind();
tv.forward();
tv.menu();
tv.smart_tv();
tv.record();
tv.play();
tv.stop();
unknown.");
TvRemote
object named
setup
serialEvent
function defined in line 11 when new data
serialEvent
255.) We append that data to the
www.it-ebooks.info
Cloning a Remote
tv
, a string named
function.
in
Serial Communication
211
command
report erratum
discuss
Need help?
Do you have a question about the Arduino Uno and is the answer not in the manual?