import os
import utime
from machine import UART, Pin

progName="mpy_uart_pico.py"
print(progName)
print("Jumper GP04 to GP05")
#print sys info
print(os.uname())

#indicate program started visually
led_onboard = machine.Pin(25, machine.Pin.OUT)
led_onboard.value(0)     # onboard LED OFF for 0.5 sec
utime.sleep(0.5)
led_onboard.value(1)

#self.uart = UART(1, 115200, parity=None, stop=1, bits=8, rx=Pin(rxPin), tx=Pin(txPin))
# speed of 400 only reads 4 bytes . . Doh?
uart = machine.UART(1,600, parity=None, stop=1, bits=8, tx=Pin(4), rx=Pin(5))
#print uart info
#uart = machine.UART(1)
print(uart)

uart.write("hello")
utime.sleep(0.1)
while uart.any():
    print(uart.read(1))
#end while
print()
print("- bye -")
#Source:http://helloraspberrypi.blogspot.com/2021/01/raspberry-pi-picomicropython-simple.html
#program end
#/mpy_uart_pico.py.txt