Newbie Problem! Get Started with NRF24L01+
-
Is there a way to receive only the last state of the sensors/actuators in the serial?
instead of:
0;0;3;0;9;read: 2-2-0 s=1,c=1,t=2,pt=2,l=2:1 0;0;3;0;9;send: 0-0-2-2 s=1,c=1,t=2,pt=2,l=2,st=ok:1 2;1;1;0;2;1it only print the "2;1;1;0;2;1" on the serial
-
I placed if statement in serial function inside MyGateway.cpp
where 0 is the gateway addressvoid MyGateway::serial(MyMessage &msg) { if (msg.sender != 0); serial(PSTR("%d;%d;%d;%d;%d;%s\n"),msg.sender, msg.sensor, mGetCommand(msg), mGetAck(msg), msg.type, msg.getString(convBuf)); }Still it doesnt work.
Heres the format:
msg.sender = GATEWAY_ADDRESS; msg.destination = destination; msg.sensor = sensor; msg.type = type; mSetCommand(msg,command); mSetRequestAck(msg,ack?1:0); mSetAck(msg,false); if (command == C_STREAM) msg.set(bvalue, blen); else msg.set(value); -
if (msg.sender != 0); serial(PSTR("%d;%d;%d;%d;%d;%s\n"),msg.sender, msg.sensor, mGetCommand(msg), mGetAck(msg), msg.type, msg.getString(convBuf));
Note the ; after the 0) which should not belong there..
-
turn off DEBUG in MyConfig.h (by commenting it out) before comping you gateway sketch to get rid of debug messages.
@hek Thank you! I will try it as soon as I go home. Can you tell me what is the expected output from the gateway if I use static id 2 for a relayActuator that I turned on?
will it be just "2;1;1;0;2;1" or will "2;255;x;x;x;x" appear? only the read/send data is hidden