I thought I would talk about testing of the PS2 V3 here as to allow me to also show outputs from Logic Analyzer and the like.
I have tried it out so far on a Botboarduino (BBD) on both the standard pins as well as on pins 10-13 and so far the joystick values appear to work Ok However I am seeing some issues with the two bytes associated with buttons. In particular the Bit associated with the Select button (first bit), appears to stick on. Also it randomly turns on and off. That is with my simple PS2 test app, that simply loops printing out the buttons as well as the 4 analog values associated with the Joystick. I press the Analog button to get the Pad to talk to the receiver. Without doing anything I see stuff like:
PS2 Input: 0:128 128 128 128
PS2 Input: 0:128 128 128 128
PS2 Input: 0:128 128 128 128
PS2 Input: 1:128 128 128 128
PS2 Input: 0:128 128 128 128
PS2 Input: 1:128 128 128 128
PS2 Input: 0:128 128 128 128
PS2 Input: 0:128 128 128 128
PS2 Input: 0:128 128 128 128
PS2 Input: 1:128 128 128 128
Again this is a real simple App:
[code]#include <PS2X_lib.h>
#if defined(MK20DX128) || defined(MK20DX256)
// For my testing on Teensy
#define PS2_DAT 2
#define PS2_CMD 3
#define PS2_SEL 4
#define PS2_CLK 5
#else
// Botboarduino…
#define PS2_DAT 10 //6
#define PS2_CMD 11 //7
#define PS2_SEL 12 //8
#define PS2_CLK 13 //9
#endif
PS2X ps2x; // create PS2 Controller Class
void setup()
{
Serial.begin(57600);
delay(5000); // give time to open monitor
int error = ps2x.config_gamepad(PS2_CLK, PS2_CMD, PS2_SEL, PS2_DAT); // Setup gamepad (clock, command, attention, data) pins
Serial.print("PS2 Init: ");
Serial.println(error, DEC);
}
void loop() {
ps2x.read_gamepad(); //read controller and set large motor to spin at ‘vibrate’ speed
Serial.print("PS2 Input: ");
Serial.print(ps2x.ButtonDataByte(), HEX);
Serial.print(":");
Serial.print(ps2x.Analog(PSS_LX), DEC);
Serial.print(" “);
Serial.print(ps2x.Analog(PSS_LY), DEC);
Serial.print(” “);
Serial.print(ps2x.Analog(PSS_RX), DEC);
Serial.print(” ");
Serial.println(ps2x.Analog(PSS_RY), DEC);
delay(100);
}
[/code]
I also verified that the output I show above is consistent with what I see on the Logic Analyzer.
I also find getting the start button to register on these can be problematic. That is I have to use my fingernail to get it pressed in far enough to register. I am also seeing similar results on my Teensy 3.1 with my Carrier board. I might try it again on the Teensy without the level shifter to see if that helps
May also dig out a BB2 to see what it is doing.
Also if I get a chance I will try to find where my old Parallax software Oscilloscope is, to see if maybe it is a voltage issue of the CMD or DAT lines.