Dear all,
I programmed arduino mega 2560 to transmit data from pc to arduino board using serial 1. I configured RX1 as input_pullup. But data was not transmitted properly to board.Instead i got only unknown data. For example, When i had sent character 'O' to board, The received data was 'H'. However i could read data from board accurately to PC using USB Serial port. I used Tera terminal for viewing data in PC. I used default baud rate 9600 and 8,N,1.
What will be the problem? Any help is highly appreciable.
Following is code:-
//#include<SoftwareSerial.h>
//SoftwareSerial Serial4=SoftwareSerial(11,12);
char ch;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
while(!Serial)
{
;
}
Serial.println("Ready...");
Serial1.begin(9600);
pinMode(18,OUTPUT);
pinMode(19,INPUT_PULLUP);
//digitalWrite(18,HIGH);
//digitalWrite(19,HIGH);
while(!Serial3)
{
;
}
Serial3.println("Ready...");
}
void loop() {
// put your main code here, to run repeatedly:
while(1)
{
if(Serial1.available())
{
ch=Serial1.read();
if(ch=='X')
break;
}
}
Serial.println(ch);
Serial.println("Muhilan Veeraraju");
Serial1.println(ch);
Serial1.println("Muhilan Veeraraju");
delay(500);
}