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] ->export() ->setDirection("input") ->setEdge("rising") ->setHandler(function($e) use($gpio) { if ($gpio[1]->getValue()) { echo "A"; } elseif ($gpio[2]->getValue()) { echo "B"; } elseif ($gpio[3]->getValue()) { echo "C"; } elseif ($gpio[4]->getValue()) { echo "D"; } else { echo "None"; } echo "\n"; }) ->setLabel("rfint") ->dumpStatus(true); for($n = 1; $n < 5; $n++) { $gpio[$n] ->setDirection("input") ->setLabel("rfbt{$n}") ->dumpStatus(true); } while(true) { $gpio->refresh(); usleep(10000); }