Moved pindefs for examples to GLOBALS.php

This commit is contained in:
Chris 2014-06-13 14:04:04 +02:00
parent f19a5bcea8
commit e73d8ca330
2 changed files with 9 additions and 1 deletions

7
examples/GLOBALS.php Normal file
View 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);

View File

@ -1,6 +1,7 @@
<?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
@ -23,7 +24,7 @@ $gpio->setMapper( new WiringPiMapper(2) );
// Access logical pin 0, since we got a mapper assigned. Otherwise this would
// be the actual GPIO0 pin.
$led = $gpio[0]
$led = $gpio[LED_A]
->export()
->setEdge(Gpio::EDGE_NONE)
->setDirection(Gpio::DIR_OUT)