Hi. Anyone know why I get a series of errors with this code, to test out an IR Receiver? It's from page 287 of 'Arduino Workshop'.
Errors include : 'IRrecv' does not name a type, 'decode_results' does not name a type.
I imported the IRremote library, but the code still doesn't work...
// Listing 15-1
int receiverpin = 11; // pin 1 of IR receiver to digital pin 11
#include <IRremote.h> // use the library
IRrecv irrecv(receiverpin); // create instance of irrecv
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // start the IR receiver
}
void loop()
{
if (irrecv.decode(&results)) // have we received an IR signal?
{
Serial.print(results.value, HEX); // display IR code on Serial Monitor
Serial.print(" ");
irrecv.resume(); // receive the next value
}
}