PHP Classes

File: example/reset.php

Recommend this page to a friend!
  Classes of Andrew Collington   iWire PHP Raspberry PI GPIO Class   example/reset.php   Download  
File: example/reset.php
Role: Example script
Content type: text/plain
Description: Example script
Class: iWire PHP Raspberry PI GPIO Class
Control a Raspberry PI board using GPIO
Author: By
Last change:
Date: 6 years ago
Size: 559 bytes
 

Contents

Class file image Download
<?php

/**
 * Phpiwire: A PHP wrapper for wiringPi
 *
 * Example of resetting the GPIO pins
 *
 * @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;

if (
PHP_SAPI !== 'cli') {
    echo
'Sorry, you can only use this via the command line.';
    return;
}

echo
"Raspberry Pi - all pins reset to LOW\n";

$pi = new Board();
foreach (
range(0, 7) as $pin) {
   
$p = $pi->getPin($pin)->mode(Pin::OUTPUT);
   
$p->write(Pin::LOW);
}