You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
522 B

require_once __DIR__."/../vendor/autoload.php";
require_once __DIR__."/GLOBALS.php";
use NoccyLabs\Gpio\Gpio;
use NoccyLabs\Gpio\GpioTickHandler;
use NoccyLabs\Gpio\Bus\SoftwareSpiBus as SPI;
use NoccyLabs\Crap\Dumper;
$gpio = new Gpio();
// create spi bus
$spi = new SPI();
// bind the spi pins
$spi->sclk = $gpio[1];
$spi->mosi = $gpio[2];
$spi->miso = $gpio[3];
// write to the spi bus
// read the two bytes exchanged with the write()
$read = $spi->read(2);