Moved pindefs for examples to GLOBALS.php
This commit is contained in:
		
							
								
								
									
										7
									
								
								examples/GLOBALS.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								examples/GLOBALS.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Set your GPIO here if they are different from the defaults!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					define("LED_A", 0);
 | 
				
			||||||
 | 
					define("LED_B", 1);
 | 
				
			||||||
 | 
					define("BTN_A", 2);
 | 
				
			||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require_once __DIR__."/../vendor/autoload.php";
 | 
					require_once __DIR__."/../vendor/autoload.php";
 | 
				
			||||||
 | 
					require_once __DIR__."/GLOBALS.php";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * This example will flash a led connected on pin 0 (GPIO17 on a Pi). If you are
 | 
					 * This example will flash a led connected on pin 0 (GPIO17 on a Pi). If you are
 | 
				
			||||||
@@ -23,7 +24,7 @@ $gpio->setMapper( new WiringPiMapper(2) );
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Access logical pin 0, since we got a mapper assigned. Otherwise this would
 | 
					// Access logical pin 0, since we got a mapper assigned. Otherwise this would
 | 
				
			||||||
// be the actual GPIO0 pin. 
 | 
					// be the actual GPIO0 pin. 
 | 
				
			||||||
$led = $gpio[0]
 | 
					$led = $gpio[LED_A]
 | 
				
			||||||
    ->export()
 | 
					    ->export()
 | 
				
			||||||
    ->setEdge(Gpio::EDGE_NONE)
 | 
					    ->setEdge(Gpio::EDGE_NONE)
 | 
				
			||||||
    ->setDirection(Gpio::DIR_OUT)
 | 
					    ->setDirection(Gpio::DIR_OUT)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user