本文整理匯總了PHP中Pi::getVersion方法的典型用法代碼示例。如果您正苦於以下問題:PHP Pi::getVersion方法的具體用法?PHP Pi::getVersion怎麽用?PHP Pi::getVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pi
的用法示例。
在下文中一共展示了Pi::getVersion方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* @link http://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/
*/
public function __construct()
{
$raspi = new Pi();
if ($raspi->getVersion() < 4) {
$this->pins = array(0, 1, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 21, 22, 23, 24, 25);
$this->hackablePins = array(4, 7, 8, 9, 10, 11, 17, 18, 21, 22, 23, 24, 25);
} else {
if ($raspi->getVersion() < 16) {
# new GPIO layout (REV2)
$this->pins = array(2, 3, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 22, 23, 24, 25, 27);
$this->hackablePins = array(4, 7, 8, 9, 10, 11, 17, 18, 22, 23, 24, 25, 27);
} else {
# new GPIO layout (B+)
$this->pins = array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27);
$this->hackablePins = array(4, 5, 6, 12, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27);
}
}
}