Created
January 28, 2020 21:04
-
-
Save kost/a0c0154524d4b457ba81318f982c38c5 to your computer and use it in GitHub Desktop.
Serial Echo in MicroPython
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep_ms | |
from machine import UART | |
def serialecho(): | |
print("serial echo server started") | |
uart = UART(2) # 16:RX 17:TX | |
uart.init(baudrate=115200, bits=8, parity=None, stop=1) | |
while True: | |
if uart.any(): | |
x=uart.read() | |
print("Got", x) | |
uart.write(x) | |
sleep_ms(100) | |
serialecho() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment