Hi I'm trying to communicate between 2 Arduino (Yun and DUE) the sender transmit an integer and the Receiver (Arduino DUE) light on a led. If i used an Arduino UNO to send data is ok but if i Try to send from YUN i see inYUN serial monitor data but nothing arrived on the reciver. I have connected them crossing tx-rx pins (but i tried all combination)
Below the code used :
SENDER :
int val = 0;
int incoming = 0;
void setup()
{
Serial.begin(9600);
Serial.println("Done"); //Is not an integer so it won't interfere
}
void loop()
{
if (Serial.available())
{
incoming = Serial.available();
Serial.print("Received value... Transmitting: ");
val = Serial.parseInt(); //Reads integers as integer rather than ASCI. Anything else returns 0
Serial.println(val); //This is being sent to the Rx board
}
}
RECEIVER :
int val = 0;
const int led = 13;
int incoming = 0;
void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
pinMode(led, OUTPUT);
}
void loop()
{
incoming = Serial.available();
while (incoming == 0) //Keep checking until there is something available
{
incoming = Serial.available();
}
val = Serial.parseInt(); //Reads integers as integer rather than ASCI. Anything else returns 0
for (int i = 0; i < val ; i++) //Flash the LED the appropriate number of times
{
digitalWrite(led, HIGH);
delay(500);
digitalWrite(led, LOW);
delay(500);
}
// Serial.println(val);
val = 0;
}
Any Ideas ?
Thanks