It can be downloaded in the pack at the end of the Instructable. Index.php is the main page of this system. Without this sometimes the table wouldn't update immediately as it is using a cached version of gpio.php. This specifies that the web server should direct any browsers not to cache the page to ensure that up-to-date information is collected by the system. Header set Cache-Control "max-age=0, no-cache, no-store$ You will also have to edit /etc/apache2/nf so that the Directory directive for /var/www/ looks as below. Of course you can still edit and work on the Pi itself. When you log into them from another compute use the same user credentials and you shouldn't have a problem. If these folders don't exist create them and make sure they are owned by your user. ![]() This creates two shares to the folders where the html pages and cgi scripts will live. Therefore I added the following to /etc/samba/smb.conf. I wanted to have easy access to the folders where the web content would be stored so I could develop on my PC as I am running my Pi headless. Then follow steps 2 and 3 of TheFreeElectron's Instructable to install the wiringPi library and the apache2 web-server with PHP. If not then a little bit of Googling will get you there. This Instructable will be assuming that the Raspberry Pi is set up with SSH, and samba access. ![]() Its far more complicated than I initially thought but it works so here we go. The routine can be set to run repeatedly to give an up-to-date representation of the pin states and is controlled by the check box and button at the bottom. This PHP page is requested by JavaScript (script.js) and the output used to set the values and functions of the value and mode buttons. PHP is used to generate a HTML page (index.php) containing the basis of the GPIO table.Īs in TheFreeElectron's instructable, JavaScript (script.js) is used to call a PHP page (gpio.php) to change the pin values and modes.Ī c++ based CGI script (gpiopinstate.cgi) outputs the status of the GPIO pins.Ī PHP page (gpio.php) executes the script and converts the output into a HTML page. However there aren't any commandline functions to read the GPIO pin modes.Ģ) Then I wrote a c++ script using the wiringPi library to return the pin value and mode, however this could not be used to monitor the status of the pins as the page took too long to refresh which was the only way to have PHP update the tableįinally I arrived at the system this instuctable uses. I tried a few different combinations of systems to control before arriving at the final version:ġ) Initially I tried using just PHP to display the GPIO table using javaScript to change the pins from high to low as in TheFreeElectron's instructable. TheFreeElectron's Simple Web Interface ( ) uses PHP and JavaScript to use buttons to control the GPIO pins. When developing Raspberry Pi electronic projects its sometimes necessary to be able to monitor the status of the GPIO pins in "real time" and to easily turn them on and off from a simple interface.
0 Comments
Leave a Reply. |