Sending an integer >32767
-
Hey there,
I'm trying to send a value between 10.000 and 99.999, but as soon as it gets bigger than 32.767 (size of int16) I receive totally senseless numbers. Is there a way to send this big number e.g. with an int32? I use V_VAR1 as message type.
Regards,
Anduril -
Hey there,
I'm trying to send a value between 10.000 and 99.999, but as soon as it gets bigger than 32.767 (size of int16) I receive totally senseless numbers. Is there a way to send this big number e.g. with an int32? I use V_VAR1 as message type.
Regards,
Anduril -
Hey there,
I'm trying to send a value between 10.000 and 99.999, but as soon as it gets bigger than 32.767 (size of int16) I receive totally senseless numbers. Is there a way to send this big number e.g. with an int32? I use V_VAR1 as message type.
Regards,
Anduril@Anduril Are you sending it from your sketch or the controller? If you are sending from the sketch make sure the "setter"
// Setters for payload MyMessage& set(void* payload, uint8_t length); MyMessage& set(const char* value); MyMessage& set(uint8_t value); MyMessage& set(float value, uint8_t decimals); MyMessage& set(unsigned long value); MyMessage& set(long value); MyMessage& set(unsigned int value); MyMessage& set(int value);can recognize the variable as a type > int16. (
longorunsigned long) i.e
unsigned long variableToBeSend = 1234567 UL ;I assume the value is now 'overflowing' to a negative number.
-
-
I found the problem... or to be honest @jkandasa found it. He told me in the MyController forum to check my receiving code and not use getInt() but getLong(). Thanks again to him.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login