Lab 8-Pico W Introduction
This commit is contained in:
parent
1e1bddf63c
commit
c7ac62b6b3
26 changed files with 8387 additions and 5 deletions
39
Lab08/MicroPython/Code/blink_external_cycle.py
Normal file
39
Lab08/MicroPython/Code/blink_external_cycle.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Micropython version of the blink program
|
||||
|
||||
import machine
|
||||
import time
|
||||
|
||||
print("\nMicroPython example code")
|
||||
print("Blink the onboard LED and LED's connected to GP15 & GP16\n")
|
||||
|
||||
led = machine.Pin('LED', machine.Pin.OUT) #configure LED Pin as an output pin and create and led object for Pin class
|
||||
# Configure GP15
|
||||
led15 = machine.Pin('GP15', machine.Pin.OUT) #configure LED Pin as an output pin and create and led object for Pin class
|
||||
# Configure GP16
|
||||
led16 = machine.Pin('GP16', machine.Pin.OUT) #configure LED Pin as an output pin and create and led object for Pin class
|
||||
|
||||
def cycleLED(ledID):
|
||||
ledID.value(True)
|
||||
time.sleep(1)
|
||||
ledID.value(False)
|
||||
time.sleep(1)
|
||||
|
||||
def turnOffLED(ledID):
|
||||
ledID.value(False)
|
||||
|
||||
print("Turn off all LED's")
|
||||
turnOffLED(led)
|
||||
turnOffLED(led15)
|
||||
turnOffLED(led16)
|
||||
|
||||
print("Cycle LEDs")
|
||||
|
||||
while True:
|
||||
|
||||
print("Cycle start")
|
||||
cycleLED(led)
|
||||
cycleLED(led15)
|
||||
cycleLED(led16)
|
||||
|
||||
time.sleep(1) #wait for one second
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue