Go Down

Topic: IR Remote Code (Read 973 times) previous topic - next topic

warboyzzzz

Mar 14, 2013, 03:50 pm Last Edit: Mar 14, 2013, 04:23 pm by warboyzzzz Reason: 1
PROBLEM SOLVED! Thanks to HazardMind!

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.
Code: [Select]
#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();
    }
}
 

HazardsMind

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

Ok, what errors?
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

Cybernetician

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)
From Idea To Invention

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.

warboyzzzz


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.

HazardsMind

Did you go into the .h file and actually change WProgram.h to Arduino.h?
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

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.

warboyzzzz


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


i dont get it, how to do that?

warboyzzzz


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.

Code: [Select]
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

PaulS

Quote
i dont get it, how to do that?

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

Use any text editor.

warboyzzzz


Quote
i dont get it, how to do that?

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

Use any text editor.

Code: [Select]
#include <IRremote.h>
#include <IRremoteInt.h>
#include <Servo.h>
#include "Arduino.h"


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

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.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

warboyzzzz


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.  :smiley-sweat:

Go Up