Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Using a list of pins with loops
- from machine import Pin
- import time
- # Setup
- leds = [] # Empty list
- for i in range(8): # 0 - 7
- led = Pin(i+6, Pin.OUT)
- leds.append(led)
- # Test the LEDs are working - one at a time
- for i in range(8):
- leds[i].value(1) # ON
- time.sleep(0.2)
- leds[i].value(0) # OFF
- print("Done")
Advertisement
Add Comment
Please, Sign In to add comment