You might want to do yourself a favor and just drop a delay(1); between the 40 broadcast receive and the transmit. You can use a timer later if you must, but the micro isn't going to be needing that 1ms.
Code:
F1 56 00 B9
10 59 00 68 02 00 2D
40 57 4D BF 5D
10 59 00 68 02 00 2D
40 57 4D BF 5D
10 59 00 68 02 00 2D
40 57 4D BF 5D
10 59 00 68 02 00 2D
40 57 4D BF 5D
10 59 00 68 02 00 2D
40 57 4D BF 5D
3553
F0 56 F1 C9
F1 56 08 B1
F1 56 08 B1
F1 56 00 B9
10 59 00 68 02 00 2D
40 57 4D BF 5D
10 59 00 68 02 00 2D
40 57 4D BF 5D
10 59 00 68 02 00 2D
40 57 4D BF 5D
10 59 00 68 02 00 2D
40 57 4D BF 5D
10 59 00 68 02 00 2D
40 57 4D BF 5D
9625
F0 56 F1 C9
F1 56 08 B1
F1 56 08 B1
F1 56 00 B9
10 59 00 68 02 00 2D
40 57 4D BF 5D
10 59 00 68 02 00 2D
40 57 4D BF 5D
10 59 00 68 02 00 2D
40 57 4D BF 5D
10 59 00 68 02 00 2D
40 57 4D BF 5D
10 59 00 68 02 00 2D
40 57 4D BF 5D
15697
F0 56 F1 C9
F1 56 08 B1
F1 56 08 B1
I'm not sure why the 08 command is being echoed twice, but you can see it sleep for about 4 seconds and then wakes up and starts broadcasting again until the micro sees the F0 query / heartbeat, and then it shuts up for another 4 seconds. Without the delay the CCM ignored the message.
Code:
if (msgfound) {
// valid msg rcvd
if (msg[0] == 0xF0 && msg[2] == 0xF1) {
delay(1);
transmit = 1;
Serial1.write(silence, sizeof(silence));
Serial.println(millis());
transmit = 0;
}
printMsg(msg, sizeof(msg));
}
I'll post the whole sketch when I have a chance to clean it up some.
Bookmarks