Closed uhrheber closed 5 years ago
Do you get any errors or other message in the console?
Should there be any errors, they're long gone when I connect a terminal. I only get a REPL prompt after pressing enter. But the LED blink code should give a hint, I guess?
I don't suppose you have a PyPortal or Hallowing to try and get the messages displayed on the screen? I tried with a Hallowing just now, but I couldn't reproduce your problem — it works for me.
By the way, which version of the firmware are you using?
4.0.0 beta 5, latest master from today, on both boards.
That's the same I tried. I suppose this is something specific to Windows.
You could try adding some delay at the beginning of the program...
Maybe. I'll try it with Linux when I'm home.
I already tried a 5 seconds delay at the beginning. No dice.
I now added a 0.5 seconds delay before and after instantiating mouse, and now it works.
This should maybe be added to the documentation/examples.
The working code is now:
from time import sleep
import analogio
import board
import digitalio
from adafruit_hid.mouse import Mouse
sleep(0.5)
mouse = Mouse()
sleep(0.5)
while True:
mouse.move(x=15)
sleep(0.07)
mouse.move(y=15)
sleep(0.07)
mouse.move(x=-15)
sleep(0.07)
mouse.move(y=-15)
sleep(0.07)
I'm closing this issue.
The Mouse code actually does this already, but it sounds like you need a bit more: https://github.com/adafruit/Adafruit_CircuitPython_HID/blob/master/adafruit_hid/mouse.py#L60
I tried the following code:
Just a simple test, to move the mouse cursor around in squares. The code runs perfectly when:
But: When the board is freshly connected to USB, the code doesn't start. Tested on ItsyBisty M4 Express and pca10059. After plugging in, the M4 Express shows a green LED, followed by an orange LED, followed by four blue flashes.
HID keyboard does work, though.
OS was Windows 10.