Mouse Click
Posted: Sun Sep 06, 2015 12:46 am
I recently got a PyBoard, and I am trying to use it as a mouse. I can make my cursor move, but I am trying to make it click when I press the button. Here is my code so far.
main.py
boot.py
I am using Windows 8. Thanks!
main.py
Code: Select all
# main.py -- put your code here!
import pyb
import select
switch = pyb.Switch()
accel = pyb.Accel()
while True:
pyb.hid((0, 0 - accel.x(), 0 - accel.y(), 0))
if switch():
#here is where it should click
pyb.delay(20)
Code: Select all
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal
import pyb
#pyb.main('main.py') # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
pyb.usb_mode('CDC+HID') # act as a serial device and a mouse