我试图让 4 个 LED 灯和关闭或组合状态,但这些 LED 中只有 2 个实际工作,即 17 ,22。当我单击按钮时,其余部分似乎没有响应
<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>
这是我的 LED 控制页面的代码,只有 17 和 22 工作,wiringpi 中实际 raspi3 的接线数/针数是否有差异?还是我做错了什么?