Skip to content

Commit b0fb5b9

Browse files
committed
Removed generic 'main.py' file names
1 parent 2b4376a commit b0fb5b9

File tree

20 files changed

+93
-6
lines changed

20 files changed

+93
-6
lines changed

00.Basics/boot.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# boot.py -- run on boot-up
2+
# can run arbitrary Python, but best to keep it minimal
3+
4+
import pyb
5+
6+
'''
7+
If your main function is not named 'main.py',
8+
the below line is required.
9+
Replace 'helloWorld.py' with the name of your
10+
script.
11+
'''
12+
13+
pyb.main('helloWorld.py') # main script to run after this one
14+
15+
16+
17+
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
18+
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse

00.Basics/helloWorld.py

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

01.LEDs/Blink/main.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

01.LEDs/blink.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import pyb
2+
3+
# The pyboard has 4 LEDs that can be controlled
4+
# these LEDs have IDs 1 - 4
5+
6+
led = pyb.LED(4) # 4 is the blue LED
7+
8+
# toggle LED state every second using on() and off() methods
9+
while True:
10+
led.on()
11+
pyb.delay(1000)
12+
led.off()
13+
pyb.delay(1000)

01.LEDs/blinkToggle.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import pyb
2+
3+
led = pyb.LED(2)
4+
5+
while True:
6+
led.toggle()
7+
pyb.delay(1000)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
import pyb
2+
led = pyb.LED(3)
3+
4+
prev_millis = 0
5+
interval = 1000
6+
7+
# avoiding pyb.delay()
18
while True:
29
curr_millis = pyb.millis()
310

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
import pyb
2+
3+
led = pyb.LED(4)
4+
brightness = 0
5+
fade_amount = 5
6+
17
while True:
28
led.intensity(brightness)
39
brightness += fade_amount
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import pyb
2+
led = pyb.LED(4)
3+
14
tick = 0 # counter variable
25

36
while True:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import pyb
2+
led = pyb.LED(4)
3+
14
tick = 0 # counter variable
25

36
while True:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# A push button is connected with a pull down resistor to pin X1
2+
3+
# X1 is the pin at the bottom-left corner of the board
4+
# (USB port pointing right, ARM chip facing the user)
5+
6+
import pyb
7+
8+
# set variable button_pin to Pin 'X1'
9+
button_pin = pyb.Pin('X1', pyb.Pin.IN)
10+
led = pyb.LED(4)
11+
112
# if button is pressed, it toggles the state of the LED and waits 300 milliseconds
213

314
while True:

0 commit comments

Comments
 (0)