'F' → Fullscreen
Using the same three-LED circuit from Activity 2.4, create a new MicroPython script named 2-5-functions.
turn_on_and_wait(led) that turns the given LED on, then waits one second.from machine import Pinimport time
led1 = Pin(28, Pin.OUT)led2 = Pin(29, Pin.OUT)led3 = Pin(30, Pin.OUT)
def turn_on_and_wait(led): led.value(1) time.sleep(1)turn_on_and_wait() once for each LED, recreating yesterday's countdown with far less repeated code.from machine import Pinimport time
led1 = Pin(28, Pin.OUT)led2 = Pin(29, Pin.OUT)led3 = Pin(30, Pin.OUT)
def turn_on_and_wait(led): led.value(1) time.sleep(1)
turn_on_and_wait(led1)turn_on_and_wait(led2)turn_on_and_wait(led3)wait parameter to the function so each call can use a different pause length.from machine import Pinimport time
led1 = Pin(28, Pin.OUT)led2 = Pin(29, Pin.OUT)led3 = Pin(30, Pin.OUT)
def turn_on_and_wait(led, wait): led.value(1) time.sleep(wait)
turn_on_and_wait(led1, 1)turn_on_and_wait(led2, 0.7)turn_on_and_wait(led3, 0.4)When you run your script:
wait parameter, each LED should turn on a little faster than the one before itAnswer the following questions before submitting your work.
turn_on_and_wait() eliminate from your Activity 2.4 code?led represent inside the function definition, and how does it get a real value each time you call the function?wait be useful beyond just this countdown?Submit the required files to the appropriate dropbox.