I have variables of type Unsigned Long Int
and would like to save its value in string
, to perform checksum and send via serial communication.
void Payload (int long unsigned lastTime, float deltaOne, float deltaTwo, int factor) {
[...]
sprintf(buffer, "CAPTION,%u,%s,%s,%d," lastTime,deltaOne,deltaTwo,factor);
SendWithCS(buffer);
}
But the value converted from int
to string
is not the same.
Example:
int long unsigned record = 11285600;
float delta1 = 50.2035;
float delta2 = 54.2035
int factor = 5;
Payload(record,delta1,delta2,factor);
Output:
CAPTION,22601,50.2035,54.2035,5,3F