Initial commit

This commit is contained in:
2014-06-05 02:20:22 +02:00
commit f3fef421f3
5 changed files with 711 additions and 0 deletions

22
examples/basic.php Normal file
View File

@ -0,0 +1,22 @@
<?php
require_once __DIR__."/../vendor/autoload.php";
use NoccyLabs\Linux\Gpio;
try {
$gpio = new Gpio\Gpio();
} catch (Gpio\Exception $e) {
error_log("Error: {$e}");
}
$pin = $gpio->export(0);
$pin->setInterrupt("rising", function() {
echo "Interrupt on GPIO0\n";
});
while(true) {
// We need to call this for our interrupt status to be polled
$gpio->update();
usleep(10000);
}