def teletype_tx(data): txbaudot(data)
n = 5 #reset the count if GPIO.event_detected(key): time.sleep(0.035) #center up on start bit while n > 0: b = readbit() a.append(b) #add next bit to end n -= 1 time.sleep(d) #wait for exit of bit and start of next time.sleep(e) #stop bit buffer a.reverse() #reverse order to match lookup table oddities baudot = ''.join(map(str, a)) #convert list to string print(baudot) if (baudot == '11111'): s = 0 #ltrs mode print("ltrs mode") txbaudot(baudot) elif (baudot == '11011'): s = 1 #figs mode print("figs mode") txbaudot(baudot) elif (s == 0 and baudot in binstr_to_asciiltrs): c = binstr_to_asciiltrs[baudot] print(c) tx_ascii_chr(c) elif (s == 1 and baudot in binstr_to_asciifigs): c = binstr_to_asciifigs[baudot] print(c) tx_ascii_chr(c) else: txbaudot(baudot)