"""Part 11: send hello over the bus, once a second. Read it on the Mac with picocom."""

from machine import Pin, UART
import time

uart = UART(1, baudrate=9600, tx=Pin(4), rx=Pin(5))
transmit_enable = Pin(2, Pin.OUT, value=0)


def send(text):
    transmit_enable.value(1)
    uart.write(text)
    uart.flush()
    transmit_enable.value(0)


count = 0
while True:
    print("sent hello", count)
    send("hello {}\r\n".format(count))
    count += 1
    time.sleep(1)
