receive message...
-
Hello . on led rgb controller or relay exemples,if you want receive a message from controller part of the code is that one :
void receive(const MyMessage &message) { //When receiving a V_STATUS command, switch the light between OFF //and the last received dimmer value if ( message.type == V_STATUS ) { Serial.println( "V_STATUS command received..." );
My Question is ; if i have 2 diferent relay nodes or rgb controller nodes ,how this simple "if MESSAGE IS V_STATUS or V_LIGHT " define what node refers to?
i mean how to select with one i want to switch on or off?
-
Node is same. But sensor may differ. You'll find sensor number in
message.sensor
.
-
so the problem of try turn one sensor on and turn the other will not exist because its already on message core?
sory about this question but in not good on code as i am on eletronics and i dont know /understand yet all the api
-
Sorry, I don't understand the question.
-
imagine i have 2 diferent arduinos with relays. i will upload the same code for both, exept the node_id .
then i want turn node 1 on. gw send message "to the air" and both arduino get message saying "light on"
what i can't understand yet is ,that part of code only says ; if message is v_light turn on, For example
where is the part saying only turn relay 1 on?(differ nodes)will both relays turn on? if they have same code(exept de id)?
-
@Tmaster a node's receive function will only be called if the message is addressed to that node.