Pages: 1 [2]   Go Down
Author Topic: Program Compiles but doesn't run at 100%  (Read 922 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hmmm.... something like this?
Code:
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);
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
if (sizeof(buflen) > 5)
Didn't you mean if (buflen > 5)?

-br

Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Pages: 1 [2]   Go Up
Jump to: