-1
#include <IRremote.h>

IRrecv IR (11);

Serial.begin(9600);

void setup() {
  // put your setup code here, to run once:
  IR.enableIRIn();
}

void loop() {
  // put your main code here, to run repeatedly:
  if (IR.decode()){
    Serial.println(IR.decodedIRData.decodedRawData, HEX);
    delay(1500);
    IR.resume();
  }
}

1 Answer 1

2

In C & C++, executable statements must be within a function. Your third statement, Serial.begin(9600); is (or should be) executable but since it is outside any function, the compiler tried to interpret it as a declaration - thus, the error.

Not the answer you're looking for? Browse other questions tagged or ask your own question.