Skip to content

Commit 3c39031

Browse files
committed
better use of boot.py
1 parent d2d633a commit 3c39031

File tree

12 files changed

+14
-57
lines changed

12 files changed

+14
-57
lines changed

00.Basics/BareMinimum/boot.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,3 @@
22
# can run arbitrary Python, but best to keep it minimal
33

44
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

00.Basics/BareMinimum/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
import pyb
2-
1+
# your main code goes here

00.Basics/HelloWorld/boot.py

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

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
2+
import pyb

00.Basics/HelloWorld/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
import pyb
2-
31
led = pyb.LED(4)
42
led.on()

01.LEDs/Blink/boot.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
1-
# boot.py -- run on boot-up
2-
# can run arbitrary Python, but best to keep it minimal
3-
41
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
2+
led = pyb.LED(4)

01.LEDs/Blink/main.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import pyb
2-
3-
led = pyb.LED(4)
41
while True:
52
led.on()
6-
delay(1000)
3+
pyb.delay(1000)
74
led.off()
8-
delay(1000)
5+
pyb.delay(1000)

01.LEDs/BlinkWithToggle/boot.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# boot.py -- run on boot-up
2-
# can run arbitrary Python, but best to keep it minimal
3-
41
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
2+
3+
led = pyb.LED(2)

01.LEDs/BlinkWithToggle/main.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import pyb
2-
3-
led = pyb.LED(4)
41
while True:
52
led.toggle()
63
pyb.delay(1000)

01.LEDs/BlinkWithoutDelay/boot.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# boot.py -- run on boot-up
2-
# can run arbitrary Python, but best to keep it minimal
3-
41
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
2+
led = pyb.LED(3)
3+
prev_millis = 0
4+
interval = 1000

01.LEDs/BlinkWithoutDelay/main.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
import pyb
2-
3-
led = pyb.LED(4)
4-
prev_millis = 0
5-
interval = 1000
6-
71
while True:
82
curr_millis = pyb.millis()
93

0 commit comments

Comments
 (0)