php-linux-gpio/examples/pcd8544.php

25 lines
487 B
PHP

<?php
require_once __DIR__."/../vendor/autoload.php";
NoccyLabs\Crap\Crap::activate();
use NoccyLabs\Gpio\Gpio;
use NoccyLabs\Gpio\Device\Display\Pcd8544Device;
$gpio = new Gpio(true);
$lcd = new Pcd8544Device;
$lcd
// we can rename devices as we like, to help in debugging
->setName("pcd8544_1")
->setPin("sda", $gpio[0])
->setPin("scl", $gpio[1])
->setPin("res", $gpio[2])
->setPin("sce", $gpio[3])
->setPin("dc", $gpio[4])
->initialize()
;