We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 15a5738 commit 517f292Copy full SHA for 517f292
examples/switch.py
@@ -22,17 +22,16 @@
22
green_led = pyb.LED(2)
23
orange_led = pyb.LED(3)
24
blue_led = pyb.LED(4)
25
-all_leds = [red_led, green_led, orange_led, blue_led]
+all_leds = (red_led, green_led, orange_led, blue_led)
26
27
-def run_loop(use_leds=[]):
+def run_loop(leds=all_leds):
28
"""
29
Start the loop.
30
31
- :param `use_leds`: Which leds to light up upon switch press.
32
- :type `use_leds`: list of integers [1-4]
+ :param `use_leds`: Which LEDs to light up upon switch press.
+ :type `use_leds`: sequence of LED objects
33
34
print('Loop started.\nPress Ctrl+C to break out of the loop.')
35
- leds = [all_leds[i - 1] for i in use_leds]
36
while 1:
37
try:
38
if switch():
0 commit comments