Forgot to point out that your status() function takes a device name (char array, aka string) and a BYTE value (otherwise known as char, or uint8_t, or an 8-bit unsigned integer). That means, when you pass a floating point value to it, it will not only be truncated to an integer (2000.123 would end up as 2000), but you're limited to a number that can be stored in 8 bits, which tops out at 255. When you truncate 2000.123 to an 8-bit integer, you get 208 (the lower 8 bits of the 16-bit integer encoding for 2000, which is binary 000 0111 1101 0000.)