-1
//www.elegoo.com
 
#include <RobotIRremote.h>
 
#define RECV_PIN  12        //Infrared signal receiving pin
#define LED       13        //define LED pin
#define L         16738455
#define UNKNOWN_L 1386468383
 
bool state = LOW;           //define default input mode
unsigned long val; 
 
IRrecv irrecv(RECV_PIN);   //initialization
decode_results results;   //Define structure type
 
void stateChange() {
  state = !state;          
  digitalWrite(LED, state);
}
 
void setup() {
  pinMode(LED, OUTPUT); //initialize LED as an output
  Serial.begin(9600);  // debug output at 9600 baud
  irrecv.enableIRIn();  // Start receiving
}
 
void loop() {
  if (irrecv.decode(&results)) { 
    val = results.value;
    Serial.println(val);
    irrecv.resume();      // Receive the next value
    delay(150);
    if(val == L || val == UNKNOWN_L) {  
      stateChange();
    }
  }
}

It says that there are errors compiling from my Arduino Uno board. How can I fix this?

4
  • 4
    what errors? ..
    – jsotola
    Nov 6, 2020 at 5:52
  • 1
    Your code compiles without errors with the "standard" IRremote library. My guess is you did not correctly install the "RobotIRremote" library, or your code is not suited for the RobotIRremote library.
    – StarCat
    Nov 6, 2020 at 8:23
  • 2
    You really, really, need to include the error messages as part of your question. Without them it is pure guesswork trying to help you.
    – Nick Gammon
    Nov 7, 2020 at 1:55
  • Please edit your question to include more details. We can't help you if we don't have all the information. Plus it could get deleted for not meeting the question standards.
    – sa_leinad
    Nov 9, 2020 at 12:44

1 Answer 1

0

This can solve your issue:

  • Sketch > Include Library > Manage Libraries
  • In the 'Filter your search' box, type 'irremote'
  • Click on 'IRremote by shirriff'

    library picture


  • Click 'Install'
  • Wait for installation to finish.
  • Click 'Close'.

Then try compiling the sketch again. The error might go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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