import p2 def setbaud(baudrate): print("Setting baud on RX=63, TX=62") bitperiod = int(p2.clkfreq())//baudrate bitmode = int(7 + (bitperiod<<16)) #set up tx pin p2.pinstart(62, int(p2.P_OE | p2.P_ASYNC_TX), bitmode, 0) #set up rx pin p2.pinstart(63, int(p2.P_ASYNC_RX), bitmode, 0)