PHP code example of ioteducation / gpio

1. Go to this page and download the library: Download ioteducation/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/ */

    

ioteducation / gpio example snippets


use I9IoT\GPIO\Device\Device;
use I9IoT\GPIO\Pin\PinMode;
use I9IoT\GPIO\Pin\PinState;

$device = new Device();
$device->newPin(26, PinMode::OUTPUT);

// Equivalente ao digitalWrite(26,HIGH) do arduino
$device->actions->digitalWrite(26, PinState::HIGH);

// Equivalente ao digitalWrite(26,LOW) do arduino
$device->actions->digitalWrite(26, PinState::LOW);

// Equivalente ao digitalRead(26) do arduino
echo $device->actions->digitalRead(26);