Go Down

Topic: Program Compiles but doesn't run at 100% (Read 944 times) previous topic - next topic

blastboot

hmmm.... something like this?
Code: [Select]
char mensagem[6];
  byte buf[VW_MAX_MESSAGE_LEN];
  byte buflen = VW_MAX_MESSAGE_LEN;

if (sizeof(buflen) > 5) { Serial.print(F("BUFFER OVERFLOW"));}

  if (vw_get_message(buf, &buflen)) {
    digitalWrite(ledRececao, HIGH);

billroy

Something like that, but you surely do not want to fall through into the rest of the code and make the overflow error happen, so put the stuff below on an else clause.

-br

Edit: hold the phone:
Code: [Select]

if (sizeof(buflen) > 5)

Didn't you mean if (buflen > 5)?

-br


blastboot

Sorry  :smiley-red: my mistake.  Yes the ELSE func. is for everything less that 6 bytes will go to the if statement of vw_get_message.

If, for some reason i have to go to an arduino mega this code will be just upload to it or do i have to make some changes?

billroy

If you move to the mega you may need to reassign some pins to avoid mega hardware conflicts, but otherwise the code should move over without changes.

-br

blastboot

Thanks a lot!  I'll test what you told me to do and see what happens. I'll post feedback.
Thanks to all for your attention!

Go Up