Skip to content

Commit 1edd48c

Browse files
committed
Added mouse example
1 parent 1afb590 commit 1edd48c

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

07.Mouse/boot.py

100644100755
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
import pyb
1+
# boot.py -- run on boot-up
2+
# can run arbitrary Python, but best to keep it minimal
23

3-
pyb.usb_mode('CDC+HID') # act as a serial and a mouse
4+
import pyb
5+
#pyb.main('main.py') # main script to run after this one
6+
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
7+
pyb.usb_mode('CDC+HID') # act as a serial device and a mouse

07.Mouse/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# main.py -- put your code here!
2+
import pyb
3+
4+
switch = pyb.Switch()
5+
accel = pyb.Accel()
6+
7+
while True:
8+
pyb.hid((switch(), accel.x(), -accel.y(), accel.z()))
9+
pyb.delay(20)

07.Mouse/mouseControl.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)