Warning message

The service having id "facebook_widget" is missing, reactivate its module or save again the list of services.

PiFace

Raspberry Pi and PiFace

My PiFace arrived last week and this was the first time I've had a proper play using it with the Raspberry Pi.

I needed to do some things first to get it working, and I thought I'd document it here for future reference. Your Raspberry Pi will need to be connected to the Internet for this install.

INSTALL

1. Firstly, the Raspberry Pi interfaces with the PiFace through SPI, so this will need enabling.

sudo pico etc/modprobe.d/raspi-blacklist.conf

Insert a # at the beginning of the line

 blacklist spi-bcm2708

like so
 #blacklist spi-bcm2708
 
2. Second, install the PiFace Digital libraries and change the permissions of the SPI interface. Luckily, running this command will automate the entire process.

sudo apt-get update

wget -O - http://pi.cs.man.ac.uk/download/install.txt | bash

And reboot your Pi once installed.

sudo reboot

TESTING

Use the PiFace emulator to test the input and outputs for the PiFace board.

You'll need to log back into your Raspberry Pi and start the GUI environment (startx)

Open the Terminal application and type:

piface/scripts/piface-emulator

This will enable you to test the inputs are recognised and the outputs software controllable.

USING PIFACE IN PYTHON

I was itching to begin controlling the PiFace board from within Python. I wrote a simple program to demonstrate it working.

import piface.pfio as piface
piface.init()
switch7 = piface.digital_read(7)
print switch7
if switch7 > 0:
   piface.digital_write(1,1)

This code simply switches output one on if switch7 is closed.

Subscribe to RSS - PiFace