php-linux-gpio/examples/pinmap.php

18 lines
340 B
PHP
Raw Normal View History

<?php
require_once __DIR__."/../vendor/autoload.php";
use NoccyLabs\Gpio\GpioMapper\WiringPiMapper;
use NoccyLabs\Gpio\Exception\GpioException;
$mapper = new WiringPiMapper(2);
$pin = 0;
try {
while (($gpio = $mapper->mapLogicalToGpioPin($pin))) {
printf(" %3d = GPIO%d \n", $pin, $gpio);
$pin++;
}
} catch (GpioException $e) {
}