from robotar import RobotAR
robot = RobotAR()
# Moves in a straight line at a speed of 50 units for 2 seconds.
robot.wheels(50, 50)
robot.sleep(5)
# Turning right
robot.wheels(210, 0)
robot.sleep(1)
# Moves in a straight line at a speed of 50 units for 2 seconds.
robot.wheels(50, 50)
robot.sleep(5)
# The robot stops
robot.halt()
or for sharp turn
from robotar import RobotAR
robot = RobotAR()
# Moves in a straight line at a speed of 50 units for 2 seconds.
robot.wheels(50, 50)
robot.sleep(5)
# Turning right
robot.wheels(91, -91)
robot.sleep(1)
# Moves in a straight line at a speed of 50 units for 2 seconds.
robot.wheels(50, 50)
robot.sleep(5)
# The robot stops
robot.halt()
from robotar import RobotAR
robot = RobotAR()
# The robot will turn right forever
while True:
robot.wheels(300, 0)
from robotar import RobotAR
robot = RobotAR()
# Moves backward at a speed of 50 units for 3 seconds.
robot.wheels(-50, -50)
robot.sleep(5)
# Stops moving for 2 seconds.
robot.halt()
robot.sleep(3)
# Moves forward for 3 seconds at a speed of 50 units.
robot.wheels(50, 50)
robot.sleep(5)
# Stops the robot
robot.halt()
from robotar import RobotAR
robot = RobotAR()
for i in range(4): # Repeat the commands 4 times
# Moves forward at a speed of 50 unit for 3 seconds
robot.wheels(50,50)
robot.sleep(3)
# Turning right
robot.wheels(210,0)
robot.sleep(1)
or for sharp turn:
from robotar import RobotAR
robot = RobotAR()
for i in range(4): # Repeat the commands 4 times
# Moves forward at a speed of 50 unit for 3 seconds
robot.wheels(50,50)
robot.sleep(3)
# Turning right
robot.wheels(91,-91)
robot.sleep(1)
from robotar import RobotAR
robot = RobotAR()
for i in range(3): # Repeat the commands for 3 times
# Moves forward at a speed of 50 units
robot.wheels(50,50)
robot.sleep(3)
# Turning right
robot.wheels(140,0)
robot.sleep(2)