When I output the values, delta behaves exactly as it should. axis, however, takes rather strange values, even negative ones, although those should be ruled out completely.
In my code I try to map the value of delta (which is time interval based on millis() ), usually in the range of 400-800 ms, to a byte (400 = 0, 800 = 255, values outside the range are clipped to the border values). I have this code:
If I type axis as byte, then, this should work?delta = constrain (delta, 400, 800) ;axis = map(delta, 400, 800, 1, 255);Wire.send (axis);
Shouldn't the to range be 0 to 255? Otherwise, yes.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16