I'm new to arduino and having Arduino Mega 2560 with me,
I wish to connect Arduino with below device using UART.http://www.cytron.com.my/viewProduct.php?pcode=SKPS&name=PS2%20Controller%20Starter%20Kit
User manual can be found in above website,
Seems complicated because there are three RX and TX pin available in Arduino Mega 2560,
Anyone here can help me in establish UART coding?
I found some useful code but not works for my project
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
unsigned char receive_data(void) //Function to wait for a byte receive from UART
unsigned char temp;
while(!Serial.available()); //Wait until data received
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