Communication with ATMEGA2560(Arduino)

Status
Not open for further replies.

Common

New Member
Good evening,

I hope you are well.
I am new on this forum.I am working on a project which uses an ATMEGA2650 located in a Board.

I have written a code to communicate with this board via RS232.I am using Arduino to talk to the board. But it does not seems to work at all.
I have set the right baud rate(9600).
My code seems to be ok(when I compile it), but when I upload the code into the board. The serial monitor keeps displaying "NOT printing".....So it looks like there is no "serial.available".

Can you help me please?

Here is my code:

void setup() {
// initialize serial port:
Serial.begin(9600);
}

void loop()
{
if (Serial.available()>0)
{
int inByte = Serial.read();
Serial.println("Writing");
Serial.print("AT+CGMR=0\r\n");
Serial.print(inByte, BYTE);
}
else
{
Serial.println("NOT Writing");
}
delay(1000);
if (Serial.available())
{
Serial.println("Reading");
int inByte = Serial.read();
Serial.print(inByte, BYTE);
}
}
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…