Example 3 Going Backwards Faster
Simulation
Real Life
What does the code do?
In this code, the robot moves backward for 1200 ms at speed 1500
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, -1500)
8 motor(3, -1500)
9 msleep(1200)
10
11if __name__ == "__main__":
12 main()
Rookie Tips
Your robot’s ports may be different to ours. Try debugging and trying different ports!