1
votes

With refer to this question:

I solve the issue by following only part of the solution (steps 2 - 4). Everything worked fine and today the checksum failed again(message not verified by server).

So I guess that I did not declared the unsigned byte array (as in step 1), and cause Arduino to randomly pick to use signed/unsigned byte array.

However, declaring unsigned byte array like this

unsigned byte MSGpack[187] = { 0x00 };

prompts error in Arduino, stating

error: 'MSGpack' was not declared in this scope

In function 'void injectByte(float, int)':

error: 'MSGpack' was not declared in this scope

How should I declare a unsigned byte array in Arduino? Thanks!

1
MSGpack must be visible wherever you are using it. If it's defined in another translation unit you will need to provide an extern declaration so the compiler knows it exists. if it's in a namespace you will likely need to provide a fully qualified name (i.e. namespacename::MSGpack`). - Captain Obvlious

1 Answers

0
votes

Try uint8_t:

uint8_t MSGpack[187] = {0};