Begin Programming in Python

Hello! I’ve set up my BrickPi3 SimpleBot & its ready to begin programming; however, I’m not sure how to begin. Any hints/tips would be appreciated. Just a little nudge would help would help tremendously.

I’ve ran a sample program or two & I want my current project to be controlling the robot with WASD (I’m not asking someone to do this for me Its for perspective only). Thanks in advance =)

Hello @wil.mcdowell15

Every BrickPi3 Python program would start the same way:

import brickpi3 # import the BrickPi3 drivers
BP = brickpi3.BrickPi3() # Create an instance of the BrickPi3 class. BP will be the BrickPi3 object.

And then you can use BP to access the motors and sensors on your BrickPi3. There is an example for pretty much everything to help you out.


If I understand, you want to control your bot wirelessly, using the WASD keys on your computer keyboard.

(Or are you asking about a “Python code development process on the BrickPi with Raspbian For Robots”? )

DI has an example for the GoPiGo3 of a keyboarded robot you could look at:

This is what the keyboarded robot control allows (for the GoPiGo3):

Basic Robot Control Panel

With this program you can test a variety of functions of the GoPiGo3 ranging from built-in LEDs to moving the robot around. The available keys are described when the program is launched.

The script can be launched this way:


The Control Panel

The control panel the user sees when the program is launched can be rendered with formatted-text this way:

Press the following keys to run the features of the GoPiGo3.
To move the motors, make sure you have a fresh set of batteries powering the GoPiGo3.

[key w ] : Move the GoPiGo3 forward
[key s ] : Move the GoPiGo3 backward
[key a ] : Turn the GoPiGo3 to the left
[key d ] : Turn the GoPiGo3 to the right
[key ] : Stop the GoPiGo3 from moving
[key ] : Drive forward for 10 centimeters
[key ] : Drive forward for 10 inches
[key ] : Drive forward for 360 degrees (aka 1 wheel rotation)
[key 1 ] : Turn ON/OFF left blinker of the GoPiGo3
[key 2 ] : Turn ON/OFF right blinker of the GoPiGo3
[key 3 ] : Turn ON/OFF both blinkers of the GoPiGo3
[key 8 ] : Turn ON/OFF left eye of the GoPiGo3
[key 9 ] : Turn ON/OFF right eye of the GoPiGo3
[key 0 ] : Turn ON/OFF both eyes of the GoPiGo3
[key ] : Change the eyes’ color on the go
[key ] : Exit