def setBothS(left, right):
    groundSensors = getGroundSensorR()
    while groundSensors[0] < 100 or groundSensors[1] < 100:
        clear()
        print("Warning: Thymio is about to fall from the table")
        setRight(0)
        setLeft(0) 
        groundSensors = getGroundSensorR()
    setRight(right)
    setLeft(left) 
                emdsLeft = (-motionX[0:motionX.shape[0],0:motionX.shape[1]/2]).clip(min = 0)
                emdsRight = motionX[0:motionX.shape[0],motionX.shape[1]/2:motionX.shape[1]].clip(min = 0)

                meanLeft = np.mean(emdsLeft)
                meanRight = np.mean(emdsRight)

                adjustmentProportionLeft = meanLeft/(meanLeft+meanRight)
                adjustmentProportionRight = meanRight/(meanLeft+meanRight)

                t1 = clock()

                thymio.setBothSaveWaitUntilReadyAndReturnTime(speed * adjustmentProportionLeft * 2, speed * adjustmentProportionRight * 2)

                sleep(t1 -t0)
                
                _div.clear()

                print (t1-t0)

                


                #sleep(timeTurn)

                # groundSensors = thymio.getGroundSensorR()
                # if groundSensors[0] < 100 or groundSensors[1] < 100:
                #     print("Warning Thymio is about to fall from the table")
                #     thymio.setRight(0)
                #     thymio.setLeft(0)
                # else:
                #     print("left: %.3f, right: %.3f" % (meanMovementLeft,meanMovementRight))