dongzhun6952 2018-04-16 02:16
浏览 141

WiringPI可以使用2个以上的GPIO引脚吗?

Ive tried to make 4 LED's light and close or a combination of state, but only 2 of these LED are actualy working,and thats 17 ,22. the rest doesnt seem to respong when i click the buttons

<html>
 <head>
 <meta name="viewport" content="width=device-width" />
 <title>LED Control</title>
 </head>
     <body>
     LED Control:
     <form method="get" action="gpio.php">
             <input type="submit" value="ON" name="on">
             <input type="submit" value="OFF" name="off">
     </form>
     <?php
     $setmode17 = shell_exec("/usr/local/bin/gpio -g mode 17 out");
     $setmode22 = shell_exec("/usr/local/bin/gpio -g mode 22 out");
     $setmode27 = shell_exec("/usr/local/bin/gpio -g mode 27 out");
     $setmode04 = shell_exec("/usr/local/bin/gpio -g mode 04 out");
     if(isset($_GET['on'])){
             $gpio_on = shell_exec("/usr/local/bin/gpio -g write 17 1");
             $gpio_on = shell_exec("/usr/local/bin/gpio -g write 22 1");
             $gpio_on = shell_exec("/usr/local/bin/gpio -g write 27 1");
             $gpio_on = shell_exec("/usr/local/bin/gpio -g write 04 1");
             echo "LED is on";
         }
         else if(isset($_GET['off'])){
             $gpio_on = shell_exec("/usr/local/bin/gpio -g write 17 0");
             $gpio_on = shell_exec("/usr/local/bin/gpio -g write 22 0");
             $gpio_on = shell_exec("/usr/local/bin/gpio -g write 27 0");
             $gpio_on = shell_exec("/usr/local/bin/gpio -g write 04 0");
             echo "LED is off";
         }
         ?>
         </body>
 </html>

this is a code of my led control page, only 17 and 22 are working, and is there a differencce in wiring numbers / pin numbers of actual raspi3 in wiringpi? or am i doing something wrong?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
    • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序