php-linux-gpio/examples/tickhandler.php

25 lines
467 B
PHP
Raw Permalink Normal View History

2014-06-12 16:14:51 +00:00
<?php
require_once __DIR__."/../vendor/autoload.php";
2014-06-13 23:32:20 +00:00
require_once __DIR__."/GLOBALS.php";
2014-06-12 16:14:51 +00:00
/*
* 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);
}