PHP code example of ballen / gpio
1. Go to this page and download the library: Download ballen/gpio library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ballen / gpio example snippets
use Ballen\GPIO\GPIO;
// Create a new instane of the GPIO class.
$gpio = new GPIO();
// Configure our 'LED' output...
$led = $gpio->pin(18, GPIO::OUT);
// Create a basic loop that runs continuously...
while (true) {
// Turn the LED on...
$led->setValue(GPIO::HIGH);
// Wait for one second...
sleep(1);
// Turn off the LED...
$led->setValue(GPIO::LOW);
// Wait for one second...
sleep(1);
}