Ejemplo n.º 1
0
    if len(sys.argv) > 1:
        filename = sys.argv[1]

    config = Config(filename)

    s = Sensor(config)

    # Infinite loop until killed, reading weight and sending data
    try:
        while True:
            #----------------
            # GET READING
            # ---------------

            # get readings from all load cells
            value = s.get_weight()

            # ---------------
            # PROCESS READING
            # ---------------
            s.process_sample(time.time(), value)

            time.sleep(0.1)

    except (KeyboardInterrupt, SystemExit):
        pass

    # Cleanup and quit
    s.finish()