Go Down

Topic: Controlling Arduino with TV remote? Help! (Read 1 time) previous topic - next topic

green_dog252

I'm pretty new to everything that has to do with Arduino, and I'm ready to start with a pretty substantial project: Using a TV remote to control my arduino. I've picked up a Universal remote and an IR sensor. I grabbed this code that gives me the 'codes' that the remote is sending out:
Code: [Select]
#include <IRremote.h>

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
}


This will print out a code in hexadecimal form to the serial monitor for each time you press a button. However, the codes it gives off are two-lined, meaning that for each button push, you get two different codes. My question is: where do I go from here? How do i use those codes to, say, turn a LED on and off? turn a servo? Please help, and if this question seems like it's coming from a 'noob' to arduino, its because it is.


Go Up