It has to be above a threshold. The accelerometer values don't go below roughly 1500. There is no - values only +. If I didn't have the threshold, the mouse would move constantly. I needed a dead zone, hence the threshold.
Posts: Location: Joined: 01.01.70 Rank: Guest
Posted on 19-03-10 18:01
Sorry to bombard you with questions, if you tilt the mouse does it drift due to gravity?
But I don't calculate g's; instead I base my calculations off of the pulse rate of the accelerometers two out-put pins.
If the pulse rate goes above a set threshold value, I take the deference of the value from the accelerometer and the threshold number
If the rate goes below a threshold, I take the deference between the threshold and the accelerometer value threshold-value. That way it stays positive.
I divide the deference by 10 because it gives me more reasonable speed values. Because 2937 - 2600 = 337(actual test values). If I added 337 pixel values to the mouse position it will move 1/4 across my screen. And even then, people could be running at lower resolutions as me too(mines 1440 x 900). So if I divide 337 by 10 in python I get 33. I know 337/10 really is 33.7, but I'm using integers not floats.
The higher the tilt, the higher the deference, the higher the speed at which the mouse moves.
Though, it sounds like rather than moving the mouse you just tilt it? My not just move it?
Unless you actually move it it seems pointless to bother to integrate the acceleration.
My point wasthat you oculd then have it so if a mouse moved an inch the onscreen cursour would move similarly (though that'd be ineffecient).