""" Test some comms via USB serial convertor to LED ring
Help from pyserial docu
IH 5/22/23
"""

import serial
import time

inttimes = [100, 100, 500, 200, 300, 400, 500, 600]
i = 0

with serial.Serial('COM3', baudrate=115200, timeout=1) as ser:
    #print(ser.name)         # check which port was really used
    #ser.write(b'!2,2000\n\r')
    #line=ser.readline()
    #print(line)
    while (i < 100):
        strtosend = '!{0},{1}\n\r'.format(str(i%8),str(inttimes[i%8]))
        ser.write(strtosend.encode())

        i += 1
        #if i > 7:
        #    i = 0

        time.sleep(0.5)

