Hey Tigershark,TigerShark wrote:Just a quick update. I am having tons of trouble getting my 485 converters to work. I am using the wireless PS2 controller and can't figure out what pins to use for high and low to enable comms. It looks like the 485 examples have pin 13 but the PS2 is set on that right now. I am trying to use Nick Sopwith's programs since they do what I want and I can't get my programs to work but don't know what pins to use.
https://sites.google.com/site/underwate ... m/hardware
Any suggestions on where the pins are set in the program would help!
Thanks!
It looks like Nick used Bill Porters library for the PS2 controller.
This is the line that sets the pins for the PS2 controller:
Code: Select all
error = ps2x.config_gamepad(13,11,10,12, true, true); //setup pins and settings: GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error
Code: Select all
error = ps2x.config_gamepad(A2,A3,A4,A5, true, false); // setup pins and settings
// GamePad(clock (blue), command (orange), attention (yellow), data (brown), Pressures?, Rumble?) check for error
Here is a snip from my TopSide code...
Code: Select all
//--------------------------------------------------------------------------------------------
// DEFINE EasyTransfer
//--------------------------------------------------------------------------------------------
// ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET
// ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET
int baudrate = 9600; //define baudrate for serial coms. Also used with ET library
byte ETloop = 0; //loop counter to recieve data more time then send data
boolean comOK = false; //verifies communcation established
const byte comOKled = 2; //LED to verify Comms OK
const byte comBADled = 8; //LED to show COMMS error
const int timeout = 1000; //time in ms to check for timeing out of coms
long lastMessage = 0; //placeholder for time since last message
EasyTransfer ETin, ETout; //create two objects
struct RECEIVE_DATA_STRUCTURE{ //put variable definitions here for the data to send/receive
//THIS MUST EXACTLY THE SAME AS THE "SEND_DATA_STRUCTURE" ON THE OTHER ARDUINO
byte ET_h2oSen;
};
struct SEND_DATA_STRUCTURE{ //put variable definitions here for the data to send/receive
//THIS MUST BE EXACTLY THE SAME AS THE "RECEIVE_DATA_STRUCTURE" ON THE OTHER ARDUINO
byte ET_brightness;
byte ET_iluminateState;
byte ET_FORSTBD; //Front Right Thruster ESC Value
byte ET_FORPORT; //Front Left Thruster ESC Value
byte ET_AFTSTBD; //Aft Right Thruster ESC Value
byte ET_AFTPORT; //Aft Left Thruster ESC Value
byte ET_VERT_LF; //Left Vertical Thruster ESC Value
byte ET_VERT_RT; //Right VErtical Thruster ESC Value
byte ET_VideoCh; //Channel for Video Feed
};
//give a name to the group of data
RECEIVE_DATA_STRUCTURE rxdata;
SEND_DATA_STRUCTURE txdata;
// ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET
// ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET
Code: Select all
//--------------------------------------------------------------------------------------------
// DEFINE EasyTransfer
//--------------------------------------------------------------------------------------------
// ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET
// ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET
int baudrate = 9600; //define baudrate for serial coms. Also used with ET library
byte ETloop = 0; //loop counter to recieve data more time then send data
boolean comOK = false; //verifies communcation established
const byte comOKled = 53; //2; //LED to verify Comms OK
const byte comBADled = 49; //8; //LED to show COMMS error
const int timeout = 1000; //time in ms to check for timeing out of coms
long lastMessage = 0; //placeholder for time since last message
EasyTransfer ETin, ETout; //create two objects
struct RECEIVE_DATA_STRUCTURE{ //put variable definitions here for the data to send/receive
//THIS MUST EXACTLY THE SAME AS THE "SEND_DATA_STRUCTURE" ON THE OTHER ARDUINO
byte ET_brightness;
byte ET_iluminateState;
byte ET_FORSTBD; //Front Right Thruster ESC Value
byte ET_FORPORT; //Front Left Thruster ESC Value
byte ET_AFTSTBD; //Aft Right Thruster ESC Value
byte ET_AFTPORT; //Aft Left Thruster ESC Value
byte ET_VERT_LF; //Left Vertical Thruster ESC Value
byte ET_VERT_RT; //Right VErtical Thruster ESC Value
byte ET_VideoCh; //Channel for Video Feed
};
struct SEND_DATA_STRUCTURE{ //put variable definitions here for the data to send/receive
//THIS MUST BE EXACTLY THE SAME AS THE "RECEIVE_DATA_STRUCTURE" ON THE OTHER ARDUINO
byte ET_h2oSen;
};
//give a name to the group of data
RECEIVE_DATA_STRUCTURE rxdata;
SEND_DATA_STRUCTURE txdata;
// ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET
// ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET ET
Hope this helps out a little?
Ryan
"KR2_Diving"