Reputation: 1
I'm trying to send data via UART from Due board to Nano board.
At first I try to send data from Nano to Due and it works.
But if I send the same data from Due to Nano it never receives it
and my Serial1
is not available.
Here is the code sending data from Due to Nano which works.
Nano send data via Serial1
to Due.
void setup()
{
Serial.begin(115200);
Serial1.begin(115200);
}
void loop()
{
delay(1000);
Serial1.print('h');
Serial.print('h');
}
Here Due receives the data.
char r;
void setup()
{
Serial.begin(115200);
Serial1.begin(115200);
}
void loop()
{
if (Serial1.available() > 0)
{
Serial.println("Serial1");
r=Serial1.read();
Serial.println(r);
}
}
And now I want to send data from Due to Nano so I just switch the code.
Due should be sending with Serial1
write or Serial1
print and the code for Due now looks like.
void setup()
{
Serial.begin(115200);
Serial1.begin(115200);
}
void loop()
{
delay(1000);
Serial1.print('h');
Serial.print('h');
}
And nano should receive the data with serial read.
char r;
void setup()
{
Serial.begin(115200);
Serial1.begin(115200);
}
void loop()
{
if (Serial1.available() > 0)
{
Serial.println("Serial1");
r=Serial1.read();
Serial.println(r);
}
}
But the Serial1
is not available.
Do someone know where the problem could be?
Upvotes: 0
Views: 220