I’ve posted before about struggling to find a real use for my Raspberry Pi, I’ve started to move a bit closer to some sort of end goal I think.. while looking through various Raspberry Pi news feeds I came across the mention of something called the BerryClip, a little add-on board for the RPi that was sold by Raspberry Pi Spy in kit form on Ebay. The purpose of the kit is really to learn about controlling some of the GPIO ports. The board ships with a web link to the site that has the build notes for the kit as well as a bundle of Python code you can download and play with. The board, as you can see, comes with 6 LED’s, a micro switch and a buzzer. The sample code has some basic demo’s of turning the LED’s on and off, with and without the button and buzz with a button push.
I’m really not a python programmer, mostly out of laziness for learning yet another language haha. So, I embarked on a quest to use the the board from a bash shell. Hizaa, I found WiringPi. This is a command line tool to control the GPIO functions of the Pi. It took me a while to figure how to map the GPIO ports to the pins as there are different ways to do this. Having found this I started to build a script to learn how to make the BerryClip do stuff. So, I wrote Berryclip.sh. <– You can download the script from that link. I may update the script from time to time so check it from time to time if you want to get the latest version .. the files are versioned so you’ll see the difference.
So, what does the script do? Well, a previous unreleased version did this
Since I made the video I’ve cleaned up the script, reorganized the menu options as well as enhanced the options and added more.
So the main menu currently looks like this
Date : 2013/04/20 19:53:37
Pick one of the following options
1 – lightfollow – The lights will all turn on and off
after each other
2 – cylon – The lights will follow each other
like a Cylon / KITT
3 – policelights – Alternating Police style lights
4 – beep – Beeps the buzzer
5 – switchtest – Only tests if you push the button
6 – switchbeep – Press the button to beep the buzzer
7 – switchleds – Press the button to light LEDs
D – Set the delay between lights off/on and beeps
Q – Quit
What do you want to do?
I may well add more options to the script, there is still more I need to learn .. ie: how to turn on multiple LEDs at one time rather then sequentially. I’m not entirely sure it can be done with GPIO alone, it’s possible I may need to use Python, while Python is still turning them on sequentially it’s able to do it so much faster then the gpio script and bash.
While learning about GPIO from writing that script I had another idea … button + speaker = Morse Code .. this got me thinking, could I make some sort of a Morse Code trainer sort of thing .. so I wrote another script which you can download and play with, morseclip.sh. Currently the open options you are:
1) Set the transmission speed of the Morse code, hard coded speeds (currently) are: 5 WPM, 12 WPM, 20 WPM and 30WPM, however I’m not happy about the sound of the 30 WPM option .. the other speeds are near enough spot on.
2) Enter the text you want to convert from English to Morse Code. Currently all English letters A-Z, Numbers 0-9 and a few punctuations are supported, you’ll see those when you enter the menu for sending text.
As always, the scripts are free for the world to fiddle with, credit back to me would be very much appreciated. I’d love to hear feed back on the scripts and even more, I’d love to see links to new updated versions of them if you mod them.