Problem with arduino uno+skps

Talk about Arduino board, sheilds. Sharing Arduino projects, program, problems, solutions, suggestions..... many more, all are welcome.

Problem with arduino uno+skps

Postby pentax1 » Sun Jun 09, 2013 11:28 am

Hello,

I have a problem using skps with arduino uno. I have test the skps using usb to uart converter and it give a result in hyperterminal. This means my skps and PS2 controller is fuctional and working. I test my arduino uno with serial connection using usb the default 0 and 1 pin. The input is from serial monitor in the arduino interface and it give no problem.

The problem came when I connect SKPS and UNO. The input from PS2 controller cannot be read by UNO because there are no response when I press any button on PS2 controller. I have try all code from the tutroial and in this forum and it still cannot work.

1) I disconnect the RX and TX pin before uploading so the code can upload correctly.
2) I use the serial software library to use digital pin as virtual serial connection to test wether pin 0 and 1 have a problem and it still cannot work.
3) RX and TX led didn't blink when connect SKPS and UNO but it will blink when I use the serial monitor in Arduino.

I have try all step and method that been suggested and it still cannot work. Do anybody have a problem same like me or just my UNO board that malfunction?
pentax1
Greenhorn
 
Posts: 3
Joined: Sun Jun 09, 2013 11:09 am

Re: Problem with arduino uno+skps

Postby robosang » Sun Jun 09, 2013 8:46 pm

Show us the actual hardware connection, and also actual code you use.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: Problem with arduino uno+skps

Postby pentax1 » Mon Jun 10, 2013 9:52 am

This is my code. Maybe need a while for the real connection image because I am at site office now. I program this code for led at Arduino board light up when button up on PS2 controller is pressed down and serial monitor will display "Button Up". Else is "Invalid". This only use default RX and TX at 0 and 1 pin.

#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;
int ledPin = 13;

void setup()
{
  Serial.begin(9600);
 
 pinMode(rx, INPUT);
 pinMode(tx, OUTPUT);
  pinMode (ledPin, OUTPUT);
  
}

void loop()
{
  digitalWrite(ledPin,LOW);
  while (Serial.available()==0);
 
  if(skps(p_Up)==0) //Check whether Up button is pressed
  {
    Serial.println("Button up");
    digitalWrite(ledPin,HIGH);
    
   }
  
  else
  {
    Serial.println("Invalid!");
  }
 
}

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
}

pentax1
Greenhorn
 
Posts: 3
Joined: Sun Jun 09, 2013 11:09 am

Re: Problem with arduino uno+skps

Postby yonghui » Mon Jun 10, 2013 10:05 am

Hi,

please try my library. download the zip folder by clicking File->Download on top left corner there under the title "Shield_PS2.zip
"
extract the folder and copy and paste into arduino libraries folder. then restart arduino ide and from arduino ide, click for the samples code and try it out.

link:
https://docs.google.com/file/d/0B8daC2S ... dkTmM/edit
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: Problem with arduino uno+skps

Postby yonghui » Mon Jun 10, 2013 10:07 am

thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: Problem with arduino uno+skps

Postby pentax1 » Mon Jun 10, 2013 6:04 pm

Hi,

Wow! Your library solved the problem. Thank you very much x 1,000,000 :D :D :D
pentax1
Greenhorn
 
Posts: 3
Joined: Sun Jun 09, 2013 11:09 am


Return to Arduino Based

Who is online

Users browsing this forum: No registered users and 17 guests