Example 2 Going Backwards Using motor
Simulator
Real Life
What does the code do?
In this code, the robot moves backward for 1200 ms at 100% speed.
Functions Used
motor( motor port, speed)
msleep( distance in ms)
Function Implementation
1#!/usr/bin/python3
2import os, sys
3sys.path.append("/usr/lib")
4from kipr import*
5
6def main():
7 motor(0, -100)
8 motor(3, -100)
9 msleep(1200)
10
11if __name__ == "__main__":
12 main()
Rookie Tips
By using negative numbers, you can make the robot go backwards!