boot.py:
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('VCP+MSC') # act as a serial and a storage device
pyb.usb_mode('VCP+HID', hid=pyb.hid_keyboard)
Code: Select all
hid = pyb.USB_HID()
print("start sending!")
while (True):
for c in range(1000):
hid.send((0,0,0x04,0,0,0,0,0))
pyb.delay(10)
hid.send((0,0,0,0,0,0,0,0))
pyb.delay(10)
hid.send((0,0,0x05,0,0,0,0,0))
pyb.delay(10)
hid.send((0,0,0,0,0,0,0,0))
pyb.delay(10)
print(str(c))
hid.send((0,0,0x28,0,0,0,0,0))
pyb.delay(10)
hid.send((0,0,0,0,0,0,0,0))
pyb.delay(10)
pyb.delay(1000)