0

I posted a snippet about using a microcontroller as a mouse, and it works great, but it moves the mouse as a stepper motion.

How would I go about making it velocity driven? Like when I tilt the accelerometer further, the faster the mouse moves. I've seen it on youtube, and looked at some source code for how they did it, but can't seem to figure it out.

The only way I would know how is a ton of if statments polling for higher values, and I know that wouldn't be the best way.

I've been told that double integrating the acceleration would be a good method, but have no idea how its done. I've been googeling for about 6 hours with no good examples or guides.

Thanks.

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Tech B
0

I don't think this is double intergration but I have the desired effects from using:

...
   if int(d[2]) > 2700:
        if x < 1400:
            x += (int(d[2])-2700)/10
    elif int(d[2]) < 2400:
        if x > 0:
            x -= (2400-int(d[2]))/10
    if int(d[5]) > 2600:
        if y > 0:
            y -= (int(d[5])-2600)/10
    elif int(d[5]) < 2400:
        if y < 900:
            y += (2400-int(d[5]))/10
...

Where int(d[2]) & int(d[5]) are the values from the accelerometer. And 2700, 2600, 2400 are the threshold values. 10 is the base speed.
I don't know what to call it, threshold deference maybe?

Edited by Tech B: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.