82
3, Copying the following program to IDE (you can also directly open the matching program in the CD), and
downloading to the development board, pulled out the transparent plastic sheet marked as "1" in the
Fig.3.2.33. Then opening the serial port monitor, observing and recording the values on it while pressing
keys on the remote control towards the receiving head as shown in Fig.3.2.37.
#include <IRremote.h>
int RECV_PIN = 12; // Define the IR receiver pin to be 12
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Initialize the infrared receiver
}
void loop() {
if (irrecv.decode(&results))
{
Serial.println(results.value, HEX); // Output the receive code in hexadecimal
Serial.println();// Add a blank line for easy viewing of the output
irrecv.resume(); // Receive the next value }
}
Fig.3.2.37 Remote Encoding Query