hello, I tried to use the code rolling master tutorial on ommunication RS485 but communication is unique between two devices.
I tried to differentiate the codes, in id 0:
and id 1:
I tried to differentiate the codes, in id 0:
// make our LED match the switch of the previous device in sequence
if (message.address == (myAddress - 1))
digitalWrite (LED_PIN11, message.switches [2]); // not run, or not recive**********************
digitalWrite (OK_PIN, LOW);
} // end of processMessage
// Here to send our own message
void sendMessage ()
{
digitalWrite (SEND_PIN, HIGH);
memset (&message, 0, sizeof message);
message.address = myAddress;
// fill in other stuff here (eg. switch positions, analog reads, etc.)
message.switches [0] = digitalRead (SWITCH_PINa0); // t's ok *******
message.switches [3] = digitalRead (SWITCH_PINa1); // t's ok ********
and id 1:
// make our LED match the switch of the previous device in sequence
if (message.address == (myAddress - 1))
digitalWrite (LED_PIN13, message.switches [3]); // ok to recive ****************
digitalWrite (LED_PIN12, message.switches [0]); // ok to recive ****************
digitalWrite (OK_PIN, LOW);
} // end of processMessage
// Here to send our own message
void sendMessage ()
{
digitalWrite (SEND_PIN, HIGH);
memset (&message, 0, sizeof message);
message.address = myAddress;
// fill in other stuff here (eg. switch positions, analog reads, etc.)
message.switches [2] = digitalRead (SWITCH_PINa2); // no send this message *****************************************