CircuitPython to read user input from REPL

A simple way to read user input from REPL is input()

while True:
    user_input = input("Enter something:")
    # note: input() is a blocking function
    # it will not return untill user press "ENTER"
    if user_input == "":
        print("~ bye ~")
        break
    else:
        print("You enter=", user_input)


Comments