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

Popular posts from this blog

480x320 TFT/ILI9488 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library

Drive 320x240 ILI9341 SPI TFT using ESP32-S3 (NodeMCU ESP-S3-12K-Kit) using TFT_eSPI library, in Arduino Framework.