PHP code example of ikarus / sps-i2c-gpio-extender

1. Go to this page and download the library: Download ikarus/sps-i2c-gpio-extender 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/ */

    

ikarus / sps-i2c-gpio-extender example snippets



use Ikarus\SPS\I2C\Extender_8GPIO_PCF_8574;
use TASoft\Bus\I2C;

$extender = new Extender_8GPIO_PCF_8574( new I2C(0x3F) );
$extender->digitalWrite( $extender::PIN_3, $extender::VAL_HIGH );
sleep(1);
$extender->digitalWrite( $extender::PIN_3, $extender::VAL_LOW );
$extender->cleanup();