/* jquery */ /* jquery accordion style*/ /* jquery init */

30 December 2012

Raspberry Pi Python: Module Installation

One of reasons for Python's popularity is its large collection of modules to help you create tools, utilities, games, websites, smartphones, robotics, and much more.

While the Standard Python Library contains well over 200 modules, sometimes you'll need to install new ones. In particular the graphical user interface (GUI) module 'Tkinter' and the impressively functional 'PyGame' module can be missing.

Assuming your Raspberry Pi has the official Debian-based Linux image on the SD card here is how you'd perform an install.

Boot up your Raspberry Pi and ensure it's connected to the Internet. Then open a new terminal window with the LXDE Desktop's 'Other->Terminal' menu option.

Now type the following Linux commands next to the '$' prompt, pressing the 'Enter' key each time:

  $ sudo apt-get install python-tk

  $ sudo apt-get install python-pygame

If prompted enter the password you used when logging on to your Raspberry Pi, and reply 'y' to any prompts.

28 December 2012

Raspberry Pi Python: Interactive Mode

Did you know Python has an interactive mode?

Here's why it's a great place to start coding with Python:
   you can be coding in seconds
   type any Python statement and see the results immediately
   Python tells you if there's something it doesn't understand
   it's an interactive way to experiment and gain coding confidence

So, boot up your Raspberry Pi and let's get started.

Python's interactive mode runs in a Linux terminal window. Two simple steps are all that's required:

Open a new terminal window

From the LXDE Desktop menu on your Raspberry Pi and select the 'Other->Terminal' option.

This will open a new terminal window.

Start the Python interpreter

Next to the '$' command prompt type 'python' and press the 'Enter' key, as below:

$ python

You'll see a short message about the version of Python, and the interactive mode cursor '>>>' will appear.

Now you can type any Python statement and press the 'Enter' key to see the results.

Visit my Raspberry Pi page for news, reviews, advice and tutorials.

25 December 2012

Raspberry Pi SD Cards

The Raspberry Pi board doesn't come with any onboard storage. Instead it has a more flexible solution, namely an SD card socket. You could build up a collection of SD cards, each with a different version of the Linux - or even a completely different operating system.

To install your chosen operating system, and still have plenty of free space for files and data, buy an 8GB or SD larger card. Operating system downloads and installation instructions are available on the Raspberry Pi Foundation website.

Unfortunately, not every SD card on the market is compatible with the Raspberry Pi. So, I'd suggest consulting a compatibility list before making a purchase. One of the most comprehensive is provided by the eLinux website.

Visit my Raspberry Pi page for news, reviews, advice and tutorials.

21 December 2012

Raspberry Pi Geany Editor

The Geany editor is an excellent environment for the Python programmer.

Here are just some of the reasons why:

Geany is a lightweight editor, so ideal for the Raspberry Pi
Geany is easy to setup and use, yet offers many customisation options
Geany understands Python syntax and colour-codes the source code
Geany checks your code for syntax errors before it runs
Geany runs your program with a single mouse click
Geany understands the syntax of many other programming languages

Your Raspberry Pi image may already include Geany. If not don't worry, it's easily installed.

Install Geany

Just open a new LXTerminal window and type the following command:

sudo apt-get install geany

Fix Geany

By default Geany uses the 'xterm' program to execute your program. Unfortunately, some Raspberry Pi images do not have the 'xterm' program installed.

To fix this problem select Geany's Edit->Preferences menu option, then select the 'Tools' tab on the left. Now change the 'Terminal:' setting to the one below:

/usr/bin/lxterminal

Press the 'Save' button to keep your changes.

Visit my Raspberry Pi page for news, reviews, advice and tutorials.

13 December 2012

Accessorise Your Raspberry Pi

Looking for some interesting and fun accessories for your £25 Raspberry Pi computer? Maybe as a Christmas stocking filler for your kids?

Then take a look at my four page Accessorise Your Raspberry Pi article in Micro Magazine issue 1239, out today.

There's plenty of choice including mini keyboards and mice, tiny wi-fi adaptors, USB hubs, cameras, all kinds of GPIO-connected electronic boards, colourful cases and books.

Here are a few extracts:

The latest version of the 'official' operating system - based on the Debian 'Wheezy' release - has all the necessary wireless drivers and support software. So, all you'll need is a suitable wi-fi dongle.

One of the most attractive is the tiny Nano Wireless USB adapter. Its miniature dimensions makes it a perfect companion to the Raspberry Pi. Yet, despite the size it's based on the more advanced 802.11N wireless standard, which delivers much greater range and speed potential than older 802.11g based alternatives.

An easy way to start is with a breadboard-based project kit, which includes the ribbon cable plus various components and wires. An example is this programmable traffic light kit (goo.gl/kbZPB). With such a kit new projects can be tackled simply by purchasing a few more electronic components.

Adafruits prototyping Pi Plate (goo.gl/DQhsw) goes a little further. The plate surrounds a breadboard grid layout with numerous connector blocks to wire up all kinds of sensors, components and electronic devices that won't easily fit on a breadboard. The Adafruit website also provide an informative tutorial about how to use the Pi Plate (goo.gl/WemiU).

Visit my Raspberry Pi page for news, reviews, advice and tutorials.