-2 c button raspberry-pi
我正在用C编写我的rapsberry pi上的gpio引脚.不会让我陷入困境.当我使用==或!=无关紧要时,循环就会卡住.这是因为当程序进入循环时它不会更新while循环使用的变量状态吗?
for(i=0;i<200;i++)
{
uint8_t valu = bcm2835_gpio_lev(SIG);
while(valu == 0)
{
uint8_t valu = bcm2835_gpio_lev(SIG);
data[i] = 0;
dan = dan + 1;
delay(0.001);
}
timeout = 0;
while(val == 1 && timeout < 70)
{
uint8_t val = bcm2835_gpio_lev(SIG);
data[i] = data[i] + 1;
dat = dat + 1;
timeout = timeout + 1;
delay(0.001);
}
delay(0.001);
}
Run Code Online (Sandbox Code Playgroud)
bcm2835指令来自覆盖范围pi使用的broadcom IC的c库.