EasyManuals Logo

Arduino uno User Manual

Arduino uno
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 #222 background imageLoading...
Page #222 background image
Serial.println("MITSUBISHI");
-
} else if (protocol == SAMSUNG) {
-
Serial.println("SAMSUNG");
-
} else if (protocol == LG) {
-
Serial.println("LG");
45
}
-
Serial.print("Value: ");
-
Serial.print(results->value, HEX);
-
Serial.print(" (");
-
Serial.print(results->bits, DEC);
50
Serial.println(" bits)");
-
}
-
-
void loop() {
-
if (ir_receiver.decode(&results)) {
55
dump(&results);
-
ir_receiver.resume();
-
}
-
}
-
First, we define an
IRrecv
object named
ir_receiver
that reads from pin 11. We
also define a
decode_result
object that well use to store the attributes of
incoming infrared signals. In
setup
, we initialize the serial port, and we initialize
the infrared receiver by calling
enableIRIn
.
Then we define the
dump
method that formats and outputs the content of a
decode_result
object to the serial port.
decode_result
is one of the core data types
of the IRremote library. It encapsulates data such as the protocol type, the
length of a command code, and the command code itself. In line 15, we read
the protocol type that has been used to encode the incoming signal. When
we receive a new signal, we output all of these attributes to the serial port.
The
loop
method is simple. We call
decode
to check whether weve received a
new signal. If yes, we call
dump
to output it to the serial port, and then we call
resume
to wait for the next signal.
Compile and upload the sketch to your Arduino. Start the serial monitor and
point a remote control at the receiver. Push some of the remotes buttons and
see what happens. Figure 30, Capture the IR codes of a Samsung remote, on
page 207 shows happens when you point a recent Samsung remote at the
receiver and press menu, up, down, left, right, and play.
If youre using a remote from a different vendor, your results will differ.
Nearly all modern remotes send a unique 32-bit value for each command,
but there are exceptions, too. For example, Panasonic devices send not only
a command value, but also an address. Also, remote control behavior differs
regarding command repetition. If you press and hold a key on a Samsung
Chapter 12. Creating Your Own Universal Remote Control 206
report erratum discuss
www.it-ebooks.info

Table of Contents

Other manuals for Arduino uno

Questions and Answers:

Question and Answer IconNeed help?

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

Arduino uno Specifications

General IconGeneral
Form factorArduino
CertificationRoHS, FC, CE
Processor model-
Processor frequency- MHz
Microcontroller modelATmega328
Microcontroller frequency16 MHz
DC input voltage7-12 V
Operating voltage5 V
DC current per I/O pin40 mA
Flash memory0.032 MB
Maximum internal memory- GB
SRAM (Static Random Access Memory)2 KB
EEPROM (Electrically Erasable Programmable Read-Only Memory)1 KB
Wi-FiNo
Number of analog I/O pins6
Number of digital I/O pins14
Weight and Dimensions IconWeight and Dimensions
Board dimensions53.4 x 68.6 mm

Related product manuals