當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Pi::getVersion方法代碼示例

本文整理匯總了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);
         }
     }
 }
開發者ID:sensi,項目名稱:php-gpio,代碼行數:21,代碼來源:Gpio.php


注:本文中的Pi::getVersion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。