Instructables

Web Control of Raspberry Pi GPIO (UPDATED)

Step 4: Shell Script

This is the part that runs on your Raspberry Pi checking for the values in the MySQL Database.

This script is pretty simple, but does require setting up.

Firstly, download the script by inputting the commands below (on your Raspberry Pi).
sudo -i and hit Return / Enter.
wget http://raspberrypi-gpio.googlecode.com/files/GPIOServer.sh and hit Return / Enter.

Once this has downloaded, type in the following:
chmod +x GPIOServer.sh and hit Return / Enter.
nano GPIOServer.sh and hit Return / Enter.

This will allow you to edit the script.
You must change the following variables at the top of the file:

mysqlusername="USERNAME HERE"
mysqlpassword="PASSWORD HERE"

These must be changed to the username and password you created previously in phpMyAdmin.

Once these have been changed, hold the Ctrl key and press x, then release the Ctrl key and press y, then hit Return / Enter.

That's it for the shell scripting session.
 
Remove these adsRemove these ads by Signing Up
richiep1 year ago
Should we store this script in the /www/directory?
Nice tutorial but the link.: http://raspberrypi-gpio.googlecode.com/files/GPIOServer.sh dos not exist anymore.
Do you have a new link for it?