cleaned up gpio and device code, implemented dummy/dry run mode
This commit is contained in:
		
							
								
								
									
										24
									
								
								examples/pcd8544.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								examples/pcd8544.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
<?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()
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user