#BlinkBlueLed_01_i(): #improv code def BlinkBlueLed_01(): #improv code #BlinkBlueLed_01.py # for running on WioTerminal using MicroPython import time import board from digitalio import DigitalInOut, Direction led = DigitalInOut(board.D13) led.direction = Direction.OUTPUT while True: #endless loop begins here led.value = True print("LED ON") time.sleep(1) led.value = False print("LED OFF") time.sleep(1) #while end #End of BlinkBlueLed_01.py # saved as "BlinkBlueLed_01.py" on the RPi. return True #improv code #def end of BlinkBlueLed_01() #improv code #the resulting file can be saved #improv code # as "BlinkBlueLed_01_i.py" on the RPi. #improv code ######################################################################################### # Note: the improvised code (the function defined above with a name ending in "_i.py") # must prepend this mainStub.py program progName="main.py" # Purpose: to improvise the running of an improvised (ending in "_i.py") program as a function # By: D@CC on 2023CMar26 # Source: http://ephotocaption.com/a/187/187.html # Note: prepend "BlinkBlueLed_01_i.py" to this program stub print("begin program:",progName) #invoke the improvised function pyName= "BlinkBlueLed_01" #improv code print("improvising: ",pyName+".py") print("named: ",pyName+"_i.def") print("by calling: ",pyName+"()") result = BlinkBlueLed_01() #improv code print("end of ", progName) #mainStub.py end #save the resulting program as main.py on the RPi