Arduino Week 7 Lesson

A simple program to read the code that is received by any Infrared remote control.

#include <IRremote.h>

const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup(){

void loop(){
if (irrecv.decode(&results)){
Serial.println(results.value, HEX);

A simple modification on this code with a if statement and sending digitalWrite high can control a LED to be turned on or off. example

if (results.value == “0789E”)


digitalWrite(LEDPIN, HIGH);


Obviously for this to work we need the LED to be added to the circuit and the LEDPIN declared (use the first two lessons for the LED addition and the LEDPIN variable declaration.