When i compile the program it gives me a error its set up for my arduino mega and i cant get it to work and also i want to use it to power my arduino Sumo Bot for The robot games.
code:
#include <PS2X_lib.h>
PS2X ps2x;
int E1 = 4;
int M1 = 5;
int E2 = 7;
int M2 = 6;
void setup(){
ps2x.config_gamepad(21, 23, 22, 24, false, false);
pinMode(E1, OUTPUT);
pinMode(M1, OUTPUT);
pinMode(E2, OUTPUT);
pinMode(M2, OUTPUT);
}
void loop(){
if (PSS_RY == 126);
{
digitalWrite(M1, HIGH);
digitalWrite(E1, HIGH);
}
if (PSS_LY == 126);
{
digitalWrite(M2, HIGH);
digitalWrite(E2, HIGH);
}
if (PSS_RY == -126);
{
digitalWrite(M1, LOW);
digitalWrite(E1, HIGH);
}
if (PSS_LY == -126);
{
digitalWrite(M2, LOW);
digitalWrite(E2, HIGH);
}
if (PSS_RY == 0);
{
digitalWrite(M1, LOW);
digitalWrite(E1, LOW);
}
if (PSS_LY == 0);
{
digitalWrite(M2, LOW);
digitalWrite(M2, LOW);
}
delay(50);
}
Error is:
arduino-1.0.3/PS2_Controller_mode_V2_0.ino:49: undefined reference to `PS2X::config_gamepad(unsigned char, unsigned char, unsigned char, unsigned char, bool, bool)’