import serial

### SET THESE PARAMETERS HERE
serial_port = '/dev/tty.usbserial'
#serial_port = 'COM1' # windows, may have to check device manager to check which COM port is assigned
pump_number = 1


### LEAVE EVERYTHING BELOW HERE THE SAME
def print_pump_number(ser,tot_range=100):
    for i in range(tot_range):
        ser.write(b'%iADR\x0D'%i)
        output = ser.readline()
        if len(output)>0:
            print('current pump set to %i'%i)
            break

ser = serial.Serial(serial_port,19200,timeout=0.1)
print_pump_number(ser)
print('setting pump to %i'%pump_number)
ser.write(b'*ADR%iB19200\x0D'%pump_number)
ser.readline()
print_pump_number(ser)
ser.close()

f028ac4f8d59d0e857092edef6b143fa3397c9a5
<mask token>


def print_pump_number(ser, tot_range=100):
    for i in range(tot_range):
        ser.write(b'%iADR\r' % i)
        output = ser.readline()
        if len(output) > 0:
            print('current pump set to %i' % i)
            break


<mask token>

<mask token>


def print_pump_number(ser, tot_range=100):
    for i in range(tot_range):
        ser.write(b'%iADR\r' % i)
        output = ser.readline()
        if len(output) > 0:
            print('current pump set to %i' % i)
            break


<mask token>
print_pump_number(ser)
print('setting pump to %i' % pump_number)
ser.write(b'*ADR%iB19200\r' % pump_number)
ser.readline()
print_pump_number(ser)
ser.close()

<mask token>
serial_port = '/dev/tty.usbserial'
pump_number = 1


def print_pump_number(ser, tot_range=100):
    for i in range(tot_range):
        ser.write(b'%iADR\r' % i)
        output = ser.readline()
        if len(output) > 0:
            print('current pump set to %i' % i)
            break


ser = serial.Serial(serial_port, 19200, timeout=0.1)
print_pump_number(ser)
print('setting pump to %i' % pump_number)
ser.write(b'*ADR%iB19200\r' % pump_number)
ser.readline()
print_pump_number(ser)
ser.close()

import serial
serial_port = '/dev/tty.usbserial'
pump_number = 1


def print_pump_number(ser, tot_range=100):
    for i in range(tot_range):
        ser.write(b'%iADR\r' % i)
        output = ser.readline()
        if len(output) > 0:
            print('current pump set to %i' % i)
            break


ser = serial.Serial(serial_port, 19200, timeout=0.1)
print_pump_number(ser)
print('setting pump to %i' % pump_number)
ser.write(b'*ADR%iB19200\r' % pump_number)
ser.readline()
print_pump_number(ser)
ser.close()

import serial

### SET THESE PARAMETERS HERE
serial_port = '/dev/tty.usbserial'
#serial_port = 'COM1' # windows, may have to check device manager to check which COM port is assigned
pump_number = 1


### LEAVE EVERYTHING BELOW HERE THE SAME
def print_pump_number(ser,tot_range=100):
    for i in range(tot_range):
        ser.write(b'%iADR\x0D'%i)
        output = ser.readline()
        if len(output)>0:
            print('current pump set to %i'%i)
            break

ser = serial.Serial(serial_port,19200,timeout=0.1)
print_pump_number(ser)
print('setting pump to %i'%pump_number)
ser.write(b'*ADR%iB19200\x0D'%pump_number)
ser.readline()
print_pump_number(ser)
ser.close()
