1

I'm trying to write code that should result in a click of the mouse, based on dwell time. I'm getting data from a gyroscope to move the mouse around. I'm not sure what the best way is to approach this from a coding perspective.

My current thinking in pseudocode is below. Basically it should be a rolling total of the last X sensor measurements, which is then compared to a dwell size/radius variable.

On a high level, what would be a feasible approach? I tried a couple of times with for loops and different code, but didn't get anywhere close. I would really appreciate advice about whether my high-level approach is even feasible. Thank you!

update array with sensor measurements for (i =  dwell time) ();
    update sum of the array = + i measurement; - (i - size of the array) measurement at each sensor measurement
if at last element of array
    if sum of the array < dwell radius; click
    loop to the beginning of the array

Though I'm not sure if (i - size of the array) measurement is even possible to do, since it could result in negative i values.

Zhelyazko Grudov
  • 367
  • 2
  • 15

0 Answers0