I made a MPU 6050 Air mouse.

The Mouse.move() value is always not greater than one, and according to the angle of the MPU 6050 changes the frequency that the command is called. I did this to have smoother specially for 3D applications such as games etc.

It's so so, as it introduces some stutter. Is there any way to make it smoother? Maybe some Java interface?

This is the code I'm using: https://drive.google.com/open?id=1XQuFAt9diHByclA5-lMqYdedCiZUDe6f

New contributor
Cristian Jorge A. Kusch is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

put on hold as too broad by gre_gor, VE7JRO, sempaiscuba, Code Gorilla, Juraj Oct 12 at 19:20

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • use arrays instead if the multiple time_a_b variables .... you have a lot of redundant code that does not do anything useful .... you use multiple variables for no reason.... positivevalx1= abs(xstep); valx1= positivevalx1; valx1 = map(valx1, 45, 0, 0 ,45 ); intervalx1=valx1; ................ just use one line intervaly1 = map(abs(xstep), 45, 0, 0 ,45 ); – jsotola Oct 10 at 19:42
  • 1
    Better still, don't use map - it's very processor intensive. Just subtract the abs value from 45... – Majenko Oct 10 at 22:23
  • Thanks for replies. I've actually looked into this and it seems it's not that simple. From what i see game developpers often need to use rather complex algorithms to achieve smooth mouse movement. I've tried running a similar code using java and the result was pretty much the same. Even a code as simple as just the loop with the mouse.move() function intruduces stuttery movement. I guess it's ok though, ill just use a trackball. – Cristian Jorge A. Kusch Oct 11 at 7:43