🐍 Setting Up Python Copy | Betabox

🐍 Setting Up Python Copy

In this section we will show you how to set up the Python environment on your car. Using Python is completely optional as it’s for advanced users. You can complete this expedition using Dragit if you’d like.

The Python Libraries we will be using are found in the sunfounder_picar package we installed in the networking set-up we did earlier.

To start using them in your Python code, all you have to do is use:

from driver import camera, stream

from picar import back_wheels, front_wheels

import picar

picar.setup()

You will have everything you need to start programming with Python!

To get started, log in to your car and download this template:

git clone https://github.com/Jmlannan/Betabox-PiCar-Template/

Move to the directory you just downloaded:

cd Betabox-PiCar-Template

Start editing with a file editor (nano is used here):

nano car.py

Save with Ctrl+O and exit with Ctrl+X

To run your program use:

python car.py

To open the camera go to:

raspberrypi:8080/?action=stream