Skip to content
Snippets Groups Projects
Commit 8338d2bc authored by Kirsa's avatar Kirsa
Browse files

added userinput

parent 9e600f9f
Branches
Tags
No related merge requests found
import sys, machine
led = machine.Pin(25, machine.Pin.OUT, machine.Pin.PULL_DOWN)
def userInput():
print("Enter on or off to set LED:")
input = sys.stdin.readline()
if input == "on\n":
led.on()
print("LED switched ON")
elif input == "off\n":
led.off()
print("LED switched OFF")
else: pass
while True:
userInput()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment