Recommend this page to a friend! |
Classes of Andrew Collington | iWire PHP Raspberry PI GPIO Class | README.md | Download |
|
DownloadPHPiWireA wrapper for wiringPi written in Zephir so that is can be compiled as an extension for PHP. RequirementsThis extension and the wiringPi library are intended to run on a RaspberryPi, so having a RaspberryPi is kind of a big requirement here! You also need to have Git installed, the wiringPi library, various build tools and the php development headers. Installing Git
Installing wiringPi
If all goes well you should be able to run the gpio utility:
Full instructions for installing wiringPi. Installing zephir
If all goes well you should be able to get the help info for zephir:
Full instructions for installing zephir. Building the extension
That will build and install the extension. You'll then have to add the extension to your php.ini file. You may find that you have two php.ini files, one for cli and one for web, so remember to add the extension to both. You'll want to add the line:
Once this is done (and the web server restarted if you're adding the extension for web use and not just cli) you should be able to see the extension info when using the ExampleHere's a very simple example of how to make an LED attached to pin 0 (using the wiringPi pin numbering scheme, BCM_GPIO pin 17) blink on and off. Assuming the LED is attached as shown:
And to run it you'll need to be running as root:
ReleasesReleases of the extension are available at: https://github.com/amnuts/phpiwire/releases/ LicenseMIT: http://acollington.mit-license.org/ |