I'm getting kinda confused here - sorry. I only want to see if the character at position[1] is Ascii 80 (P). I'm not bothered about the rest. I modded the code to that shown below; but get this output:
where both "received from node 1" messages (30s=1 and 30s=2) appear at the same time on the serial monitor and my minute counter increments..
if I add a delay (say 400mS), then each message only appears with each send , (whch is every 30sec) . Its as though without the delay the RFM69 doesn't have time to clear it message rec'd status.
received from node 1, message [P] 30s= 1
received from node 1, message [P] 30s= 2
1
received from node 1, message [P] 30s= 1
received from node 1, message [P] 30s= 2
2
received from node 1, message [P] 30s= 1
received from node 1, message [P] 30s= 2
3
received from node 1, message [P] 30s= 1
received from node 1, message [P] 30s= 2
4
received from node 1, message [P] 30s= 1
received from node 1, message [P] 30s= 2
5
void GetClockPulse()
{
// RECEIVING
// In this section, we'll check with the RFM69HCW (RFM69)to see
// if it has received any packets:
if (radio.receiveDone()) // Got one!
{
// Print out the information:
Serial.print(F("received from node "));
Serial.print(radio.SENDERID, DEC);
Serial.print(F(", message ["));
// The actual message is contained in the DATA array,
// and is DATALEN bytes in size:
//for (byte i = 0; i < radio.DATALEN; i++)
//{
Serial.print((char)radio.DATA[1]);
// }
Serial.print(F("] 30s= "));
if (radio.DATA[1] == 80) // Ascii P
{
radio.DATA[1] = 0;
radio.DATA[2] = 0;
/* display.setCursor(102, 1);
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE, BLACK); //clear noise botton of screen
display.print(ThirtySec);
display.display();
*/
//increment time every two pulses
Serial.println (ThirtySec);
//NOW=millis();
// TimeCheck();
if (ThirtySec >= 2) //second pulse
{
ThirtySec = 0;
MINUTE++; // add one minute
TimeChangedFlag = 1;
Serial.println( MINUTE);
}
//delay(1000);
ThirtySec++;
}