Implemented the tick handler

This commit is contained in:
2014-06-12 18:14:51 +02:00
parent e37e63980c
commit d7cfbcaf28
4 changed files with 110 additions and 5 deletions

23
examples/tickhandler.php Normal file
View File

@ -0,0 +1,23 @@
<?php
require_once __DIR__."/../vendor/autoload.php";
/*
* This example demonstrate a possibility, but not a best practice. When using
* the tick handler, make sure the code being executed has ticks declared.
*
*/
use NoccyLabs\Gpio\Gpio;
use NoccyLabs\Gpio\GpioTickHandler;
$gpio = new Gpio(true);
$gpiotick = new GpioTickHandler();
$gpiotick->registerGpio($gpio);
declare(ticks=5);
while(true) {
usleep(10000);
}