Python Libraries

All of our Python modules can be installed directly from the PIP Python repository (PiPy) simply by typing sudo pip install pi-plates from the command line. If you're installing for the first time then visit our Documentation page to get detailed instructions or execute the following sequence of commands from a terminal window:

The above installs the Pi-Plate Python libraries into a folder located at /usr/local/lib/python2.7/dist-packages/piplates.

If you need to uninstall the library then simply type sudo pip uninstall pi-plates.

If you want to update a library, the cleanest approach is to run sudo pip uninstall pi-plates from the command line followed by sudo pip install pi-plates.

We also have a set of Python 3 modules that can be downloaded with sudo pip3 install Pi-Plates

ppLOGGER

Go Here to read all about how to download and use our free data logger application, ppLOGGER.

Examples

In addition to the code below, you can find a number of code snippets in our documentation.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

Object Oriented MOTORplate Demo Using Tkinter

Here is an object oriented Tkinter program we wrote to drive two stepper motors and four DC motors using two MOTORplates. The code has classes for DC motors, stepper motors and the title block. When run, the program puts up the following display:

2015-07-18-072558_1920x1080_scrot

We wrote this program to provide an easy method to demonstrate all of the capabilities of the MOTORplate as well as to teach ourselves object oriented programming with Python and Tkinter. You can copy and paste the code below or install it directly to your Raspberry Pi using these steps from the command line:

  1. Download the files from our server with: sudo wget https://pi-plates.com/downloads/MOTORdemo.tar.gz
  2. Then decompress them into your home directory: sudo tar -xzvf MOTORdemo.tar.gz

The program assumes two MOTORplates attached to the stack at addresses 0 and 1. In our demo, we had two stepper motors connected to the board at address 0 and four DC motors driven by the board at address 1. Besides learning teaching ourselves the basics of object oriented programming, we also learned about manipulating font sizes with the tkFont module. For example, we wanted a large title so we created a bold, 40 point version of the built in Helvetica font with: self.title = tkFont.Font(family='Helvetica', size=40, weight='bold')