Exemplo n.º 1
0
from mettler_toledo_device import MettlerToledoDevice
dev = MettlerToledoDevice()  # Might automatically find device if one available
# if it is not found automatically, specify port directly
#dev = MettlerToledoDevice(port='/dev/ttyUSB0') # Linux specific port
dev = MettlerToledoDevice(
    port='/dev/ttyACM0')  # Linux specific port for abstract control model
dev = MettlerToledoDevice(
    port='/dev/tty.usbmodem262471')  # Mac OS X specific port
#dev = MettlerToledoDevice(port='COM3') # Windows specific port
dev.get_serial_number()
#1126493049
dev.get_balance_data()
#['XS204', 'Excellence', '220.0090', 'g']
dev.get_weight_stable()
#[-0.0082, 'g'] #if weight is stable
#None  #if weight is dynamic
dev.get_weight()
#[-0.6800, 'g', 'S'] #if weight is stable
#[-0.6800, 'g', 'D'] #if weight is dynamic
dev.zero_stable()
#True  #zeros if weight is stable
#False  #does not zero if weight is not stable
dev.zero()
#'S'   #zeros if weight is stable
#'D'   #zeros if weight is dynamic
Exemplo n.º 2
0
from mettler_toledo_device import MettlerToledoDevice
dev = MettlerToledoDevice() # Might automatically find device if one available
# if it is not found automatically, specify port directly
#dev = MettlerToledoDevice(port='/dev/ttyUSB0') # Linux specific port
dev = MettlerToledoDevice(port='/dev/ttyACM0') # Linux specific port for abstract control model
dev = MettlerToledoDevice(port='/dev/tty.usbmodem262471') # Mac OS X specific port
#dev = MettlerToledoDevice(port='COM3') # Windows specific port
dev.get_serial_number()
#1126493049
dev.get_balance_data()
#['XS204', 'Excellence', '220.0090', 'g']
dev.get_weight_stable()
#[-0.0082, 'g'] #if weight is stable
#None  #if weight is dynamic
dev.get_weight()
#[-0.6800, 'g', 'S'] #if weight is stable
#[-0.6800, 'g', 'D'] #if weight is dynamic
dev.zero_stable()
#True  #zeros if weight is stable
#False  #does not zero if weight is not stable
dev.zero()
#'S'   #zeros if weight is stable
#'D'   #zeros if weight is dynamic
Exemplo n.º 3
0
            robot.moveXY(xy)

    if weigh_aliquots:
        from mettler_toledo_device import MettlerToledoDevice
        scale = MettlerToledoDevice(port='/dev/ttyUSB2')

        # TODO some scale command to automate this? setting to make it not
        # sleep?
        print('Tap the scale to wake it up, if it is not already.')
        #
        zeroed = False
        # TODO this doesn't seem to work if we can't wake the scale...
        print('Waiting for stable weight to zero... ', end='')
        sys.stdout.flush()
        while not zeroed:
            zeroed = scale.zero_stable()
        print('done')

        scale_xy = (632, 2)
        # 23 would stick sometimes
        scale_z = 23

        def weigh_vial():
            """Returns vial weight in grams. Assumes start at safe Z height.
            """
            # just to be safe. could delete later.
            robot.moveZ2(0)
            #
            robot.moveXY(scale_xy)
            robot.moveZ2(scale_z - 0.5)