Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
php-gpio の API の使用例です。
require 'vendor/autoload.php';
use PhpGpio\Gpio;
$pin = 25;
print "Setting up pin $pin" . PHP_EOL;
$gpio = new GPIO();
$gpio->setup($pin, "out");
for ($i = 0; $i < 20; $i++) {
print "Turning on pin $pin" . PHP_EOL;
$gpio->output($pin, 1);
print "Sleeping" . PHP_EOL;
print "Turning off pin $pin" . PHP_EOL;
$gpio->output($pin, 0);
print "Sleeping" . PHP_EOL;
print "Unexporting all pins" . PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment