Sample – REPL Prompt - renesas/micropython GitHub Wiki

image

  • Key in non-blocking from the REPL (Read Evaluate Print Loop) prompt to display it.
from sys import stdin, stdout
from select import poll, POLLIN

poller = poll()
poller.register(stdin, POLLIN)

while True:
    for k, ev in poller.poll(10):
        c = stdin.read(1)
        n = stdout.write(c)
        if c == "\r":
            stdout.write("\n")

image