from arduino import Commands, Arduino from time import sleep from motors import Motors from mission import Mission board = Arduino() board.connect() move = Motors() mission = Mission() mission.startMission() while True: move.position(10,100) sleep(4) move.rotate(-90,100) sleep(4) move.position(10,100) sleep(4) move.rotate(-90,100) sleep(4) move.position(10,100) sleep(4) move.rotate(-90,100) sleep(4) move.position(10,100) sleep(4) move.rotate(-90,100) sleep(4) move.position(-10,100) sleep(4) move.rotate(90,100)
from arduino import Commands, Arduino from motors import Motors from mission import Mission import time board = Arduino() board.connect() move = Motors() mission = Mission() mission.startMission() start_time = time.time() print("--- %s seconds ---" % (time.time() - start_time)) move.position(20,200) there=int(move.getAtPosition()) print("initial position status is :") print(there) print("now moving to requested position") while (there==0): print("waiting for desination, status is:") time.sleep(0.2) there=int(move.getAtPosition()) print(there) print("Arrived there") print("--- %s seconds ---" % (time.time() - start_time)) print("now going to rotate and see how that goes") move.rotate(-90,200) print("initial position status is :") there=int(move.getAtPosition()) print(there) print("now turning by requested amount") while (there==0):
print("Will now go forward speed 50 for 1S") sleep(0.8) move.forward(50) sleep(1) move.stop() print("Will now go backwards speed 50 for 1S") sleep(1) move.backward(50) sleep(1) move.stop() print("robot will now move forward by 60 cm on button press") sleep(1) mission.startMission() sleep(1) move.position(60,100) sleep(5) move.stop() print("leftMotor(speed,direction) and rightMotor (speed,direction) on button press") sleep(1) mission.startMission() sleep(1) move.leftMotor(50,1) sleep(1) print("moving right motor now") move.rightMotor(50,0) sleep(1) print("now both motors together now") move.rightMotor(50,1) move.leftMotor(50, 1)