Hello!
I'm working on my DFRobotShop Rover and I'm trying to control my car via Infrared and using IRremote library(GitHub - Arduino-IRremote/Arduino-IRremote: Infrared remote library for Arduino: send and receive infrared signals with multiple protocols).
However, After I verify the code it appear the error message:
IRremote\IRremote.cpp.o: In function "MATCH (int , int)':
/IRremoteInt.h:176:multiple definition of 'MATCH (int, int)'
sketch_oct21a.cpp.o:C:\Documents and Settings\Administrator\My Documents\Arduino\libraries\IRremote/IRremoteInt.h:176: first defined here
Below is my code:
////??????????????????????????
#include <IRremote.h>
#include <IRremoteInt.h>
//???????? ?????????????
#define UP 0xC26BF044 //?????UP?
#define DOWN 0xC4FFB646 //?????DOWN?
#define LEFT 0x758C9D82 //?????LEFT?
#define RIGHT 0x53801EE85LL //?????RIGHT?
#define STOP 0x8AF13528 //?????STOP?
/*To control the rover, Copy and paste the code below into the Arduino software*/
int E1 = 6; //M1 Speed Control
int E2 = 5; //M2 Speed Control
int M1 = 8; //M1 Direction Control
int M2 = 7; //M2 Direction Control
int RECV_PIN = 11; //????????
IRrecv irrecv(RECV_PIN);//???
decode_results results;//???????
void setup(void)
{
int i;
for(i=5;i<=8;i++)
pinMode(i, OUTPUT);
Serial.begin(9600);
irrecv.enableIRIn(); // ????
}
void loop(void)
{
if (irrecv.decode(&results))
{
Serial.println(results.value, HEX);
int leftspeed = 255;
int rightspeed = 255;
switch(results.value)
{
case UP://2???
forward (leftspeed,rightspeed);
break;
case DOWN://4???
reverse (leftspeed,rightspeed);
break;
case LEFT://8???
left (leftspeed,rightspeed);
break;
case RIGHT://6???
right (leftspeed,rightspeed);
break;
case STOP://5???
stop();
break;
default:
stop();
delay(100);
}
irrecv.resume(); // Receive the next value
}
stop();//??????
}
void stop(void) //Stop
{
digitalWrite(E1,LOW);
digitalWrite(E2,LOW);
}
void forward(int a,int b)
{
analogWrite (E1,a);
digitalWrite(M1,LOW);
analogWrite (E2,b);
digitalWrite(M2,LOW);
}
void reverse (int a,int b)
{
analogWrite (E1,a);
digitalWrite(M1,HIGH);
analogWrite (E2,b);
digitalWrite(M2,HIGH);
}
void left (int a,int b)
{
analogWrite (E1,a);
digitalWrite(M1,HIGH);
analogWrite (E2,b);
digitalWrite(M2,LOW);
}
void right (int a,int b)
{
analogWrite (E1,a);
digitalWrite(M1,LOW);
analogWrite (E2,b);
digitalWrite(M2,HIGH);
}
Please help me figure out what's wrong with my program.
Thank you!
Tony