Scroll down until you see the line 'DocumentRoot /var/www/html'
Replace '/var/www/html' with the path you copied from the pwd command. The line should now read 'DocumentRoot /home/yourName/aaimi_gpio'.
If you are doing anything important with your Raspberry Pi you should consider adding htaccess password protection while you are here.
I'll try to get a tutorial going for that soon.
Press CONTROL + x then type y and press Enter to save the file and exit Nano.
Apache needs to restart before the changes take effect.
sudo service apache2 restart
Now we'll set the ownership and permissions for the AAIMI GPIO folder and its files. We'll set the owner as you, and the group as www-data, the default Apache user.
Enter the following command, substituting '/path/to/aaimi' with the full path from the pwd command, and your Linux username in place of 'yourName'.
sudo chown -R yourName:www-data /path/to/aaimi
For example, I type 'sudo chown anth:www-data /home/anth/aaimi_gpio'.
Now to change permissons. Again, substituting your full path, type:
sudo chmod 750 /path/to/aaimi
Finally, navigate into the aaimi_gpio folder and type:
sudo chmod 644 *.html *.css *.js *.php *.txt
If you want to use an Arduino with your Pi you'll need to upload the sketch from the sensor_monitor_arduino_08 folder.
After that, connect the Arduino to the Pi via USB. You can't use a GPIO-based serial connection at the moment because the program sets the GPIO pins on the fly. I'll get this feature going soon because USB serial is not really practical for the Raspberry Pi Zero.
You'll also need to enable the Arduino option in aaimi_gpio.py.
Go to line 43 and change the arduino_enabled variable to "yes".
By default the serial port is '/dev/ttyUSB0'. If your Arduino connects over a different port you'll need to change the port setting on line 166.
Save the code and restart the AAIMI GPIO program.
Once you have tested the system you can set the program to start at boot, but for now we'll start it manually via SSH.
To start the main Python program type:
sudo python aaimi_gpio.py
The program will start in standby mode. It will not load the pin list and won't define or monitor any pins. Instead it will just listen to a socket waiting for the switch-on command.
To test your web configuration, open a web browser and type the IP address for the Pi. You should see the AAIMI GPIO pin configuration page.
Click the On/Off tab and you'll see options for starting and stopping the program, and shutting down the pi.
Click Start AAIMI GPIO
AAIMI will load the default list of GPIO pins. If you've previously set some pins it will configure the pins accordingly. It will then start the main loop to monitor any input pins and pins set to timers or timeout.
That's it, you are ready to configure your GPIO pins.
in the next article I'll show you step-by-step how to use the various features.