I followed the steps as shown in tutorial,
i test the SKPS connection with arduino by lights up led if button up pressed, as shown in below coding
- CODE: SELECT_ALL_CODE
//skps protocol
#define p_Up 4
#define p_Right 5
#define p_Down 6
#define p_Left 7
#define p_L2 8
#define p_R2 9
#define p_L1 10
#define p_R1 11
#define p_Triangle 12
#define p_Circle 13
#define p_Cross 14
#define p_Square 15
const int rx = 0;
const int tx= 1;
void setup()
{
Serial.begin(9600); //Set serial baud rate as 9600
Serial.flush(); //Waits for the transmission of outgoing serial data to complete.
//Set the mode for each digital pins whether input or output
pinMode(rx, INPUT);
pinMode(tx, OUTPUT);
pinMode(3,OUTPUT);
}
void loop ()
{
if(skps(p_Up)==0) //Check whether Up button is pressed
{
digitalWrite(3,HIGH); //Call move_up function, it will move forward
}
else if(skps(p_Down)==0) //Check whether Down button is pressed
{
digitalWrite(3,LOW); //Call move_down function, it will move backward
}
}
unsigned char receive_data(void) //Function to wait for a byte receive from UART
{
unsigned char temp;
while(!Serial.available()); //Wait until data received
temp=Serial.read();
return temp; //Return the received data
}
unsigned char skps(unsigned char data) //Function to send out a byte via UART
{
Serial.write(data); //Send new data
return receive_data(); //Return received data
}
when PS2 controller button pressed, STATUS led in SKPS blinking shows signal received, but the led didt lights up.
I'm using arduino IDE 1.0.1
Did i missed anything? appreciate if anyone can help