Hello,
I'm really not sure, but try changing:
unsigned int raw = (data[1] << 8) | data[0];
//to
int raw = (data[1] << 8) | data[0];
//or
long raw = (data[1] << 8) | data[0];
Unsigned values will never go below 0, they will overflow, so I think that's your problem ![]()