Even the simplest test I can think of fails :
Code: Select all
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal
import machine
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', hid=pyb.hid_keyboard) # act as a serial device and a keyboard
Code: Select all
# main.py -- put your code here!
import pyb
kb = pyb.USB_HID()
def onSwitch():
kb.send(bytearray(b'Hello World !'))
sw = pyb.Switch()
sw.callback(onSwitch)
But when I press the button, the window that has focus on the PC receives nothing,
and the serial console shows (part of) an error :
Code: Select all
MicroPython v1.8.2 on 2016-07-10; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>> Uncaught exception in ExtInt interrupt handler line 3
MemoryError: