I need some clarification on putting my lynxmotion PS2 receiver on the botboarduino.
on the how to guide there is a problem, the literature has the following setup
Pin 6 DAT , PWR, GND
Pin 7 CMD
Pin 8 ATT
Pin 9 CLK
but the diagram shows this
Pin 6 DAT
Pin 7 CMD
Pin 8 ATT
Pin 9 CLK, PWR, GND
does it matter where I put the power and ground, is pin 6 or pin 9 the best location ?
I have a question that’s more technical. I installed the ps2x program and libraries to my arduino application. I loaded the program onto the board and the receiver is getting a signal, I think ( the LED’s both come on solid when control pad is turned on) now here is where I am stuck. I cannot get any communication from the board to the controller to come up on the serial monitor, I have uploaded 3 programs they are : “debug” program, the “example” program and the original programs “PS2X”. All I get is the message " No controller found, check wiring, see readme.txt to enable debug. visit www.billporter.info for troubleshooting tips Unknown Controller type " on the serial monitor. I don’t know what I need to do to fix this communication error. I am very new to arduino so I don’t know where to start, I assume all the “code” I have downloaded is good, since everyone else on various forums says it works, and I have the same download they do. From the little I understand of code, the printout I am getting is due to error = 0. Any advice or insight would be much appreciated
Note: I use my own version of Bill Porters PS2 library, which earlier I did some tweaking on. Not sure which of the changes I have are now in the official version. github.com/KurtE/Arduino-PS2X
Recently I modified the library to make it work on a Teensy 3.1
I also have a simple test program that I use from time to time to see if I am talking OK to the library. I have an ifdef at the start that if it is not a Teensy, to use the Botboarduino default pins… PS2_Test-140223a.zip (650 Bytes)
I tried the master program and the example that went with it, no communication came up on serial monitor other than the " seek help. things don’t work " code, yet again.
When i loaded your test zip file the serial monitor came to life. it began to string a lot of numbers really fast. I don’t know what they meant but at least there was some communication. I tried pressing some buttons and a joystick to see if there would be a “new” line of numbers appear in the repeating lines, there was “new” numbers put into the strings, so things are working. Such a relief, the past 2 days of going nowhere has been hard to take, seeing my great idea for a RC excavator fading.
Being as I am new and lost as to what the next step is. what do I do next ? I am wanting to learn how to program the botboarduino to function as a smart RC controller, linked to the PS2 control pad. That being said a very fast moving string of numbers flying by is good news, at least i know there is some communication between the board and control pad. but what do i do with it now ?
Thank you for your time, and thank you for the test program
Good news, after playing around, I have communication between the board and gamepad. Been working with the “example” that comes with the ps2 library, and am slowly assigning the proper text to fit which button I am pressing. Now I just need to get the kinks out of the basic communications, as in assigning proper text to each button to pop up in serial monitor correctly.
Thank you both for your input, it has helped me to learn a lot so far.
I am confused? Why are you making this change? Why is 10-13 better? Could it be when you built the PS2 level shifter for the newer PS2s which did not work at 5v, you installed the optional Pull-up resistors on the DAT and Clock lines? If so maybe what is happening is the code by default enables the Atmega328p’s weak PU resistor on that line, plus the PU on the Botboarduino and now your PU on the PS2, which is now making it too strong?
If so, did you try to simply remove the PS2 PU jumper on the Botboarduino? Looking at the manual: lynxmotion.com/images/html/build185.htm at #5 in the picture, simply remove the jumper marked JPU. To me it would be easier than trying to explain to everyone that if you have the new PS2 you need to move to different IO pins and update your program…
I have figured out the previous issue I had with communication, it has been a good learning experience so far. Now a new problem has emerged
here is my code so far, taking into considerartion I am new at this
the code was the example code from the PS2 download, and I have been editing it to run just the buttons in the serial monitor. Once I get them working I will add in the Analog sticks to the serial monitor aswell.
#include <PS2X_lib.h> //for v1.6
PS2X ps2x; // create PS2 Controller Class
int error = 0;
#define PS2_DAT 6
#define PS2_CMD 7
#define PS2_SEL 8
#define PS2_CLK 9
void setup(){
Serial.begin(57600);
int error = ps2x.config_gamepad(PS2_CLK, PS2_CMD, PS2_SEL, PS2_DAT); // Setup gamepad (clock, command, attention, data) pins
Serial.print("PS2 Init: ");
}
void loop(){
if(error == 1) //skip loop if no controller found
return;
ps2x.read_gamepad(); //read controller
// left control pad
if(ps2x.Button(PSB_PAD_UP))
Serial.print("Up held ");
if(ps2x.Button(PSAB_PAD_RIGHT))
Serial.print("Right held ");
if(ps2x.Button(PSB_PAD_LEFT))
Serial.print("LEFT held ");
if(ps2x.Button(PSB_PAD_DOWN))
Serial.print("DOWN held ");
// L1, L2, R1, R2 buttons
if(ps2x.Button(PSB_L1))
Serial.println("L1 pressed");
if(ps2x.Button(PSB_R1))
Serial.println("R1 pressed");
if(ps2x.Button(PSB_L2))
Serial.println("L2 pressed");
if(ps2x.Button(PSB_R2))
Serial.println("R2 pressed");
// circle, square, x, and triangle
if(ps2x.Button(PSB_RED))
Serial.println("Circle pressed");
if(ps2x.Button(PSB_PINK))
Serial.println("Square pressed");
if(ps2x.Button(PSB_BLUE))
Serial.println("X pressed");
if(ps2x.Button(PSB_GREEN))
Serial.println("Triangle pressed");
delay(20);
}
The issue I have is I keep getting the message " Right held" about every 10th cycle of the loop, if I hold down any buttons ( circle, square, triangle, x ), R1, R2, L1, or L2 they are displayed, but once I let go of other buttons the “right held” comes back. If I just press and release the buttons the proper text appears, but on the next loop cycle “right held” is back. If I hold down or push on my control pad in any direction I get the proper text back, but with “right held” attached to it. I have taken apart the gamepad and checked for dirt or debris in the controller, it is clean, so nothing is touching the button, causing it to think I am pressing buttons. I tried to hold down the circle button and the “right held” appears on average on the 10th cycle, sometimes after 3 cycles or as many as 17 cycles. I need to get rid of this errant signal as I would like to use the function of the right side of the control pad, and not have a random signal accidently move a servo or fire up a motor when not needed.
any advice or help will be greatly appreciated
Yes I tried replacing the PSAB, with PSB. no difference.
Also when I add the lines if code to show when my start and select buttons are used they give the same errant codes as the Dpad
with the gamepad controller on my serial monitor comes to life with " select held " and “right held”, but the print out is at a slower pace, every 20th or so line , not every 10th. if I let the gamepad sit idle, the errant responces come at a longer interval between popping up than they did before I added the start and select section of code.
I started small and just put in the colored buttons into the code, they worked fine, then I added the L1, L2, R1, R2 buttons they worked fine aswell, then I added the directional pad, is works fine in responding to what I am pressing other than the “right held” issue. Now with “select” added in, and errant responces from them I am thinking is might be a reciever or board issue.
Any advice or ideas on how to test the reciever/board, or fix the problem I have would be greatly appreciated.
Thank you for your time