BerryClip Graphical Test Program

0

This is my first go with pygame on the Raspberry Pi.

I thought I’d share with you this little project for testing that your BerryClip 6 LED addon board is working properly.

Here is a screenshot of the program running in the graphical interface :

BerryClip GUI Screenshot

It is quite a simple program and works with keyboard or mouse. It gives you visual cues in the program and tests all the functionality of the Berryclip.

How to download, install and run

All the code is over at bitbucket, here’s some guidance…

How to install it

If you want to get all the BerryClip sample files and examples, skip this step and follow the one of the sections below called ‘Download all the BerryClip files …’

Download the testclip.py file into a directory of your choosing (one you have write access to, e.g. /home/pi).  To download go here: testclip.py or at the prompt…

wget https://bitbucket.org/vinnievg/berryclip/raw/default/6LED/testclip/testclip.py

The program background (berryClip.JPG) needs to be in ‘data’ directory relative to the python script. So create a sub directory:

mkdir data

Download the data/berryClip.JPG (link here) into the data directory…

cd data
wget https://bitbucket.org/vinnievg/berryclip/raw/default/6LED/testclip/data/berryClip.JPG

Download all the BerryClip files, as a zip file (optional)

Download all the berryclip files as a zip using this:

wget https://bitbucket.org/vinnievg/berryclip/get/default.zip -O berryClip.zip
unzip berryClip.zip
mv vinnievg-berryclip* berryclip

The final command just renames the resulting directory to something without the bitbucket user name and version string.
To get to the testclip section:

cd berryclip/6LED/testclip

Download all the BerryClip files, using mercurial(hg) (optional)

hg is a source control system, very much like git.

To grab a copy of the berryclip files using hg just type the following commands…
Raspbian doesn’t come pre-installed with mercurial, so install it (you’ll only have to do this the once):-

sudo apt-get install mercurial

Now download a copy of my berryclip repository:-

hg clone https://bitbucket.org/vinnievg/berryclip

To get to the testclip section:-

cd berryclip/6LED/testclip

How to start it

If you are directly connected to the raspberry pi, either at the console or in the graphical desktop, change into the right folder using the cd command, then type the following at a terminal prompt:-

sudo python testclip.py

If you are ssh’ing in with -X then I suggest using gksudo:-

gksudo python testclip.py

sudo is needed to allow the python GPIO library to access the pi’s gpio pins.

How to use it

  • Click on the buzzer and leds to activate and deactivate them.
  • Press the switch on the BerryClip and see the the switch highlighted on the screen
  • Use keyboard keys 1 to 6 and ‘b’ to activate and deactivate the relevant outputs
  • Press ESC to exit the program
  • Press Ctrl+C to exit the program from the terminal window.

Enjoy,
Graham

Share.

Leave A Reply