Simple web control with PiFace Control And Display

Difficulty: easy

Learn how to control your PiFace Control And Display using a browser from any computer on your local network.

Getting started with simple web control for PiFace Control And Display

To control your PiFace Control And Display (CAD) from a browser, first login into your Raspberry Pi with your PiFace CAD connected, then open a Terminal and enter the command:
git clone https://gist.github.com/9620246.git
Move into this directory: cd 9620246
And run the file inside: python3 simplewebcontrolcad.py
This will start a simple web server for you to access.

Viewing the PiFace Digital's state

Open a browser on your Pi or another computer on your network, and enter the following address into the address bar:
http://192.168.1.3:8000
The browser will return the state of the switches, LCD text and cursor position

Note: Replace 192.168.1.3 with your Pi's ip address. Hint, it will have been printed out when you started the web server.

Writing to PiFace CAD

You can set the LCD text of PiFace CAD by adding the following line to the end of the address:
/?lcd_text=Hello
So the full command will be:
http://192.168.1.3:8000/?lcd_text=Hello

Web command in browser for writing <i>Hello</i> to PiFace CAD's LCD screen
Web command in browser for writing Hello to PiFace CAD's LCD screen
This text will appear on your PiFace CAD LCD screen.

Other web PiFace CAD commands

To control other aspects of your PiFace CAD, such as the backlight, enter the following into the browser:
http://192.168.1.3:8000/?command=backlight_on

Try these: Replace backlight_on in the previous instruction with one of the following:
backlight_off
blink_off
blink_on
clear
display_off
display_on
home