dongzhun6952
dongzhun6952
2018-04-16 02:16

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

  • wiringpi
  • php

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条回答