2014-06-12 16:31:39 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once __DIR__."/../vendor/autoload.php";
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This example demonstrates mapping GpioPins to bit values and writing bits
|
|
|
|
* in parallel.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
use NoccyLabs\Gpio\Gpio;
|
|
|
|
use NoccyLabs\Gpio\Util\BitmappedGpio;
|
|
|
|
use NoccyLabs\Gpio\GpioMapper\WiringPiMapper;
|
|
|
|
|
|
|
|
$gpio = new Gpio();
|
|
|
|
$gpio->setMapper( new WiringPiMapper(2) );
|
|
|
|
|
|
|
|
$par = new BitmappedGpio();
|
|
|
|
for($n = 0; $n < 7; $n++) {
|
|
|
|
$par->setGpioPin($n,$gpio[$n]);
|
|
|
|
}
|
|
|
|
|
2014-06-12 20:38:46 +00:00
|
|
|
for($n = 0; $n < 10; $n++) {
|
|
|
|
$par->write(0xFF);
|
|
|
|
usleep(500000);
|
|
|
|
$par->write(0x00);
|
|
|
|
usleep(500000);
|
|
|
|
}
|