You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
931 B

require_once __DIR__."/../vendor/autoload.php";
require_once __DIR__."/GLOBALS.php";
* This example will flash a led connected on pin 0 (GPIO17 on a Pi). If you are
* not on a Pi, please change (or remove) the mapper below and update the pin
* numbers to match.
use NoccyLabs\Gpio\Gpio;
use NoccyLabs\Gpio\GpioMapper\WiringPiMapper;
try {
$gpio = new Gpio();
} catch (Gpio\Exception $e) {
error_log("Error: {$e}");
// The mapper translates GPIO to logical pins and vice versa
$gpio->setMapper( new WiringPiMapper(2) );
// Access logical pin 0, since we got a mapper assigned. Otherwise this would
// be the actual GPIO0 pin.
$led = $gpio[LED_A]
->setLabel("LED pin")
// Flash the led
$x = 0;
while(true) {
$x = (int)(!$x);