arduino-libs-manchester icon indicating copy to clipboard operation
arduino-libs-manchester copied to clipboard

receiveComplete() never true

Open Miq1 opened this issue 6 years ago • 4 comments

I am at a loss here: my receiver logic is close to that of the examples:

#include <Manchester.h>

#define ALERT 13
#define DATA_433 4

uint16_t packet;
uint16_t last_packet;

void setup() {
  pinMode(ALERT, OUTPUT);
  digitalWrite(ALERT, LOW);
  man.setupReceive(DATA_433, MAN_1200);
  man.beginReceiveArray(2, (uint8_t *)&packet);
  last_packet = 0x2f3a;
  Serial.begin(9600);
  Serial.println("");
}
void loop() {
  Serial.println(packet, HEX); // #1 - see below
  if (man.receiveComplete()) 
  {
    Serial.println(packet, HEX); // #2 - see below
    if(packet!=last_packet)
    {
      if(packet&0x4000) digitalWrite(ALERT, HIGH);
      last_packet = packet;
    }
    man.beginReceiveArray(2, (uint8_t *)&packet);
  }
}

the first Serial.println() (marked #1) in the loop bravely prints out the received packet, whereas #2 never prints anything at all. So it looks like receiveComplete() never is true.

What am I missing here?

Receiver is an Arduino Nano, if that matters.

Miq1 avatar Mar 16 '18 13:03 Miq1

Ideas, anyone?

Miq1 avatar Mar 22 '18 08:03 Miq1

Anyone here? :-)

Miq1 avatar Mar 26 '18 11:03 Miq1

Did you figure this out? I may have an idea.

joshuajayg avatar May 31 '19 00:05 joshuajayg

No, never. I finally switched to a solution where I was sending a trailing constant data pattern to detect the end of transmission.

Miq1 avatar May 31 '19 03:05 Miq1