except:
    print("Some error in modules")
    Modules.closeConnections()
    exit(1)

counter_of_failed_frames = 0
isMoving = False


try:
    while True:
        Modules.getModule('bt').sendData('dir: l')
        frame = vs.read()
        frame = imutils.resize(frame, width=width)

        data = Modules.getData()
        print(data)

        if(data['bt'] == 'Lock: lock'):
            isMoving = False
        elif(data['bt'] == 'Lock: unlock'):
            isMoving = True
        
        if isMoving:
            coords_of_qr = get_coords_from_qr_code(frame, code)
            if coords_of_qr == False:
                counter_of_failed_frames += 1
            else:
                counter_of_failed_frames = 0

                if coords_of_qr['w'] > width // 4: