How to use float data from a sensor with the Arduino mouse library

I’m using a gyroscope, which returns angular velocity in floats. I’m trying to use this data with the arduino mouse library. The move function requires a signed character. I’m not what the best way is to convert the float data from the sensor into signed char.

In what way can I do this, losing the least in terms of precision?

I found out you can use dtostrf to transfer floats into an array of characters, but not sure what to do following this or if it’s even the best way.

I would appreciate any guidance.

If you mention a library that does not ship with the Arduino IDE, it is courteous to include a link to the library so that we will be looking at the same one that you are writing about.

What Arduino board are you using?

Read the how get the most out of this forum sticky.

Post edited. I’m trying this on the micro, but I could also try on the Leonardo one.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.