Hi
I have 2 arduinos
1 Mega and one duomilanove
have some problem in sending serial data ( arduino to arduino)
as sender I have the mega (TX) and reciber is the duemilanove (RX)
seems that I can not recibe the info
here is code for Sender
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print('1', BYTE);
delay(2000);
Serial.print('0', BYTE);
delay(2000);
}
CODE for reciber
#define LEDPIN 13
byte val;
void setup()
{
pinMode (LEDPIN, OUTPUT);
Serial.begin(9600);
}
void loop()
{
if (Serial.available()) {
val = Serial.read();
if (val == '1') {
Serial.println("1");
digitalWrite(LEDPIN, HIGH);
} else if (val == '0') {
Serial.println("0");
digitalWrite(LEDPIN, LOW);
}
}
}