EasyManuals Logo

Arduino Pro Mini User Manual

Arduino Pro Mini
311 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #226 background imageLoading...
Page #226 background image
that at the time of this writing, the IRremote library is able to decode remote
controls from Sanyo, Mitsubishi, and LG, but it doesnt support sending
commands to devices from these manufacturers.
After weve established the basis, we can implement all commands with a
single function call, so implementing
power
,
menu
,
play
, and so on is a piece of
cake.
Using the
TvRemote
class is easy, too. In the following sketch, we use it to
control a Samsung TV from the Arduinos serial monitor:
RemoteControl/TvRemote/TvRemote.ino
const unsigned int BAUD_RATE = 9600;
Line 1
-
TvRemote tv;
-
String command = "";
-
boolean input_available = false;
5
-
void setup() {
-
Serial.begin(BAUD_RATE);
-
}
-
10
void serialEvent() {
-
while (Serial.available()) {
-
const char c = Serial.read();
-
if (c == '\n')
-
input_available = true;
15
else
-
command += c;
-
}
-
}
-
20
void loop() {
-
if (input_available) {
-
Serial.print("Received command: ");
-
Serial.println(command);
-
if (command == "guide") tv.guide();
25
else if (command == "power") tv.power();
-
else if (command == "tools") tv.tools();
-
else if (command == "source") tv.source();
-
else if (command == "info") tv.info();
-
else if (command == "hdmi") tv.hdmi();
30
else if (command == "zero") tv.zero();
-
else if (command == "one") tv.one();
-
else if (command == "two") tv.two();
-
else if (command == "three") tv.three();
-
else if (command == "four") tv.four();
35
else if (command == "five") tv.five();
-
else if (command == "six") tv.six();
-
else if (command == "seven") tv.seven();
-
Chapter 12. Creating Your Own Universal Remote Control 210
report erratum discuss
www.it-ebooks.info

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino Pro Mini and is the answer not in the manual?

Arduino Pro Mini Specifications

General IconGeneral
BrandArduino
ModelPro Mini
CategoryMotherboard
LanguageEnglish

Related product manuals