IR Remote Code

PROBLEM SOLVED! Thanks to HazardMind!

HazardsMind:
Go to the IRremote library folder → look for IRremoteInt.h → right click and select EDIT → find WProgram.h and change it to Arduino.h → Save file → restart the arduino software.

Question: I’m trying to continue my small project, which is control 3 servos with IR remote (directly to arduino), each button (1,2,3) makes different types of movement. can anybody help with my program? when I verify this i get
a lot of compiling error. Please help me fix it.

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

int IR_PIN = 2;            // IR Sensor pin
IRrecv irrecv(IR_PIN);
decode_results IRResult;
int pos = 0;
unsigned long IRValue;

Servo myservo1;
Servo myservo2;
Servo myservo3;


void setup()
{
  myservo1.attach(9);
  myservo2.attach(10);
  myservo3.attach(11);
  pinMode(IR_PIN, INPUT);
  irrecv.enableIRIn();
}

void loop()
{
  if (irrecv.decode(&IRResult))                              
    {
      IRValue = IRResult.value;                              
      if ((IRValue == 1) || (IRValue == 2049))     
      {
        //If 1 is pressed
        }
      if ((IRValue == 2) || (IRValue == 2050))                                    
      {
        //If 2 is pressed
        }
       if((IRValue == 3) || (IRValue == 2051))                             
         {
          //If 3 is pressed
         }
       delay(1000);
       irrecv.resume();
    }
}

when I verify this i get a lot of compiling error.

Ok, what errors?

How to use this forum - please read.

Yes, Please read.

it will tell you if there is any error in your code always post it with your code. 8)

I have the IRremote library installed in the right place, although it is an older version that was not compatible with 1.0+.

I pasted your code, and got a number of errors. I edited IRremoteInt.h, changed WProgramh to Arduino.h, and all the errors went away.

Perhaps you need to do that, too.

PaulS: I have the IRremote library installed in the right place, although it is an older version that was not compatible with 1.0+.

I pasted your code, and got a number of errors. I edited IRremoteInt.h, changed WProgramh to Arduino.h, and all the errors went away.

Perhaps you need to do that, too.

i'm sorry, what do you mean by 'changed WProgramh to Arduino.h' ? i have changed the code and the number of errors is smaller.

Did you go into the .h file and actually change WProgram.h to Arduino.h?

Somewhere or other, a dot got lost.

I change WProgram.h to Arduino.h, in an include statement.

If you still have errors, you need to post them.

HazardsMind:
Did you go into the .h file and actually change WProgram.h to Arduino.h?

i dont get it, how to do that?

PaulS: Somewhere or other, a dot got lost.

I change WProgram.h to Arduino.h, in an include statement.

If you still have errors, you need to post them.

In file included from KI_Alat_Lipat_Baju.ino:2:
D:\Arduino Libraries\libraries\IRremote/IRremoteInt.h:87: error: 'uint8_t' does not name a type
D:\Arduino Libraries\libraries\IRremote/IRremoteInt.h:88: error: 'uint8_t' does not name a type
D:\Arduino Libraries\libraries\IRremote/IRremoteInt.h:89: error: 'uint8_t' does not name a type
D:\Arduino Libraries\libraries\IRremote/IRremoteInt.h:92: error: 'uint8_t' does not name a type

i dont get it, how to do that?

Perhaps, if you used capital letters, like a big boy...

Use any text editor.

PaulS:

i dont get it, how to do that?

Perhaps, if you used capital letters, like a big boy…

Use any text editor.

#include <IRremote.h>
#include <IRremoteInt.h>
#include <Servo.h>
#include "Arduino.h"

I have put these, but the error still came. why?

Go to the IRremote library folder -> look for IRremoteInt.h -> right click and select EDIT -> find WProgram.h and change it to Arduino.h -> Save file -> restart the arduino software.

HazardsMind: Go to the IRremote library folder -> look for IRremoteInt.h -> right click and select EDIT -> find WProgram.h and change it to Arduino.h -> Save file -> restart the arduino software.

Thank you so much for the info, now my code is working. :sweat_smile: