private/IRTimer.hpp: No such file or directory: something is wrong when I try to use IR remote to control servo motor

#include <Servo.h>
#include <IRremote.h>

IRrecv IR(3);
Servo Servo1;

int servoPin = 9; 
int potPin = A0;
void setup() {
  // put your setup code here, to run once:
  Servo1.attach(servoPin);
  IR.enableIRIn();
  Serial.begin(9600);
}

void loop() {
  if(IR.decode())
  {
    Serial.println(IR.decodedIRData.decodedRawData, HEX);
    if(IR.decodedIRData.DecodedRawData == 0xEA15FF00)
    {
      Servo1.write(90);
    }
  }
  delay(1500);
  IR.resume();
}

Above is my code, I was trying to use IR remote to control a servo motor, but the error says I am missing some files. Is there anything that I can add to the code to fix it?

Welcome to the forum

As your topic does not relate directly to the installation or operation of the IDE it has been moved to the Programming Questions category of the forum

Please do not post pictures of code and error messages

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

Hi @heresy_milk. I'm going to ask you to provide the full verbose output from a compilation.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Check the box next to "Show verbose output during: ☐ compile" in the "Preferences" dialog.
  3. Click the "OK" button.
    The "Preferences" dialog will close.
  4. Select Sketch > Verify/Compile from the Arduino IDE menus.
  5. Wait for the compilation to fail.
  6. You will see a "Compilation error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
  7. Open a forum reply here by clicking the "Reply" button.
  8. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block icon on toolbar
  9. Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
    This will paste the compilation output into the code block.
  10. Move the cursor outside of the code block markup before you add any additional text to your reply.
  11. Click the "Reply" button to post the output.

In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here:

  1. Open any text editor program.
  2. Paste the copied output into the text editor.
  3. Save the file in .txt format.
  4. Open a forum reply here by clicking the "Reply" button.
  5. Click the "Upload" icon (Upload icon) on the post composer toolbar:
    Upload icon on toolbar
    The "Open" dialog will open.
  6. Select the .txt file you saved from the "Open" dialog.
  7. Click the "Open" button.
    The dialog will close.
  8. Click the "Reply" button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.


FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: /Users/genze/Library/Arduino15/packages/arduino/hardware/avr/1.8.6
Using core 'arduino' from platform in folder: /Users/genze/Library/Arduino15/packages/arduino/hardware/avr/1.8.6

Detecting libraries used...
/Users/genze/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/genze/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/Users/genze/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /private/var/folders/k7/9b92p2td43zc04sm613qcdh00000gn/T/arduino/sketches/FC0274833EEFA17427E3F7242FD5C3EC/sketch/sketch_jun4a.ino.cpp -o /dev/null
Alternatives for Servo.h: [Servo@1.2.1]
ResolveLibrary(Servo.h)
  -> candidates: [Servo@1.2.1]
/Users/genze/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/genze/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/Users/genze/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/Users/genze/Library/Arduino15/libraries/Servo/src /private/var/folders/k7/9b92p2td43zc04sm613qcdh00000gn/T/arduino/sketches/FC0274833EEFA17427E3F7242FD5C3EC/sketch/sketch_jun4a.ino.cpp -o /dev/null
Alternatives for IRremote.h: [IRremote@4.3.1]
ResolveLibrary(IRremote.h)
  -> candidates: [IRremote@4.3.1]
/Users/genze/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/genze/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/Users/genze/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/Users/genze/Library/Arduino15/libraries/Servo/src -I/Users/genze/Documents/Arduino/libraries/IRremote/src /private/var/folders/k7/9b92p2td43zc04sm613qcdh00000gn/T/arduino/sketches/FC0274833EEFA17427E3F7242FD5C3EC/sketch/sketch_jun4a.ino.cpp -o /dev/null
Alternatives for digitalWriteFast.h: [digitalWriteFast@1.2.0]
ResolveLibrary(digitalWriteFast.h)
  -> candidates: [digitalWriteFast@1.2.0]
In file included from /Users/genze/Documents/Arduino/libraries/IRremote/src/IRremote.h:10:0,
                 from /private/var/folders/k7/9b92p2td43zc04sm613qcdh00000gn/T/.arduinoIDE-unsaved202454-41868-4mfw2y.5ps8/sketch_jun4a/sketch_jun4a.ino:2:
/Users/genze/Documents/Arduino/libraries/IRremote/src/IRremote.hpp:264:10: fatal error: private/IRTimer.hpp: No such file or directory
 #include "private/IRTimer.hpp"  // defines IR_SEND_PIN for AVR and SEND_PWM_BY_TIMER
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
/Users/genze/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/genze/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/Users/genze/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/Users/genze/Library/Arduino15/libraries/Servo/src -I/Users/genze/Documents/Arduino/libraries/IRremote/src -I/Users/genze/Documents/Arduino/libraries/digitalWriteFast /private/var/folders/k7/9b92p2td43zc04sm613qcdh00000gn/T/arduino/sketches/FC0274833EEFA17427E3F7242FD5C3EC/sketch/sketch_jun4a.ino.cpp -o /dev/null
Alternatives for private/IRTimer.hpp: []
ResolveLibrary(private/IRTimer.hpp)
  -> candidates: []
exit status 1

Compilation error: exit status 1