PHP code example of ikarus / sps-i2c-dac

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



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

$dac = new DAC_MCP4625( new I2C( DAC_MCP4625::DEFAULT_ADDRESS ) );
$dac->setOutput(2048); // Set to half of vdd.
sleep(5);
$dac->setOutput(0, true); // Set to 0 and store this.