import serial
import time

# Define the serial port and baud rate.
# Ensure the 'COM#' corresponds to what was seen in the Windows Device Manager
ser = serial.Serial('COM7', 9600)
counter = 32 # Below 32 everything in ASCII is gibberish

while True:
     counter +=1
     ser.write(str.encode(chr(counter))) # Convert the decimal number to ASCII then send it to the Arduino
     print (ser.readline().strip().decode( "utf-8" )) # Read the newest output from the Arduino
     print(counter)
     time.sleep(.1) # Delay for one tenth of a second
     if counter == 255:
       counter = 32
