PHP Classes

iWire PHP Raspberry PI GPIO Class: Control a Raspberry PI board using GPIO

Recommend this page to a friend!
  Info   View files Example   View files View files (1)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 172 All time: 8,784 This week: 139Up
Version License PHP version Categories
phpiwire 1.0.0Free For Educatio...5Hardware, Zephir
Description 

Authors

Andrew Collington
Contributors


Contributor

This package can control a Raspberry PI board using GPIO.

It is a PHP extension written in Zephir that interfaces with wiringPi to control a Raspberry Pi's GPIO and access values from pins of a board.

The package is able to read or write data from any pin available in each of the supported boards.

Innovation Award
PHP Programming Innovation award nominee
May 2018
Number 3
Raspberry PI is popular platform for tiny computer boards that can be purchased at a low cost and can run many types of software runs on a Linux based OS, including PHP.

This package is a PHP extension written in Zephir that can run on a Raspberry PI board to access values of pins that may be connected to external sensors.

Manuel Lemos
Picture of Andrew Collington
  Performance   Level  
Name: Andrew Collington <contact>
Classes: 16 packages by
Country: United Kingdom
Age: 49
All time rank: 574 in United Kingdom
Week rank: 568 Down19 in United Kingdom Down
Innovation award
Innovation award
Nominee: 3x

Example

<?php

/**
 * Phpiwire: A PHP wrapper for wiringPi
 *
 * Checking pin status
 *
 * @author Andrew Collington, andy@amnuts.com
 * @version 0.2.0
 * @link https://github.com/amnuts/phpiwire
 * @license MIT, http://acollington.mit-license.org/
 */

namespace Phpiwire;

$pi = new Board();
$p = $pi->getPin(0)->mode(Pin::OUTPUT);

echo
$p, "\n";

if (
$p->read() == Pin::LOW) {
    echo
"Setting {$p->getId()} to HIGH\n\n";
   
$p->write(Pin::HIGH);
} else {
    echo
"Setting {$p->getId()} to LOW\n\n";
   
$p->write(Pin::LOW);
}

echo
$p, "\n";


  Files folder image Files  
File Role Description
Files folder imageexample (1 file)

  Files folder image Files  /  example  
File Role Description
  Accessible without login Plain text file pin.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:172
This week:0
All time:8,784
This week:139Up