0

hid.mouse overflowerror
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

hid.mouse overflowerror

by jhhender on Thu Jun 13, 2019 10:06 am

Hello, I'm developing an assistive technology design project for first-year engineering students. I'm using Mu1.0.2 with CircuitPython 4.0.1 and CircuitPlayground Express with samd21g18 and adafruit-circuitpython-bundle-4.x-mpy-20190611. A key component of the project will be using accelerometer output to control the mouse cursor. In working through a sample implementation of the solution, I'm running into an error coming out of the hid library (I think). Input into mouse.move works fine when moving to the right or down. E.g.,

mouse.move(8, 0)

will move the cursor 8 to the right.

mouse.move(0, 8)

will move 8 down.

But any attempt to move to the left or up throws an error. E.g.,

mouse.move(-8, 0)

gives:

Traceback (most recent call last):
File "code.py", line 16, in <module>
File "adafruit_hid/mouse.py", line 147, in move
OverflowError: value must fit in 1 byte(s)

The problem is with negative numbers being input into mouse.move, but that seems to be the intended usage as given by the examples at https://circuitpython.readthedocs.io/pr ... mouse.html

Such as:

# Move 100 to the left. Do not move up and down. Do not roll the scroll wheel.
m.move(-100, 0, 0)
# Same, with keyword arguments.
m.move(x=-100)

# Move diagonally to the upper right.
m.move(50, 20)
# Same.
m.move(x=50, y=-20)

Thanks for any guidance!

jhhender
 
Posts: 1
Joined: Mon Jun 10, 2019 9:09 pm

Please be positive and constructive with your questions and comments.