square
This commit is contained in:
24
square.py
24
square.py
@ -1,15 +1,27 @@
|
||||
from time import sleep
|
||||
import robot
|
||||
|
||||
POWER = 64
|
||||
TURN_TIME = 0.75
|
||||
DRIVE_TIME = 2.5
|
||||
|
||||
def main():
|
||||
arlo = robot.Robot()
|
||||
|
||||
turn_time = 3
|
||||
left_speed = 64
|
||||
right_speed = 64
|
||||
print(arlo.go_diff(left_speed, right_speed, 1, 1))
|
||||
sleep(turn_time)
|
||||
print(arlo.stop())
|
||||
try:
|
||||
while True:
|
||||
# Driving forward
|
||||
arlo.go_diff(POWER, POWER, 1, 1)
|
||||
sleep(DRIVE_TIME)
|
||||
arlo.stop()
|
||||
|
||||
# Turning 90 degrees
|
||||
arlo.go_diff(POWER, POWER, 1, 0)
|
||||
sleep(TURN_TIME)
|
||||
arlo.stop()
|
||||
|
||||
except KeyboardInterrupt:
|
||||
arlo.stop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Reference in New Issue
Block a user