结果向串口发送结果时,有的对,有的不对,这种if语句只执行一次,下次再满足时好像有的清零语句没有执行,为什么
if(Det_red1==0&&Det_green2==0&&flag1) //第一路红灯,同时第二路为绿灯 ,
{
time_green2 =0;
TR0 = 1;
flag3 = 1;
flag1 = 0;
}
if(Det_red1==0&&Det_yellow2==0&&flag3) //红1亮黄2亮
{
TR0 = 0;
green2_cycle[m5] = time_green2;
m5++;
flag1 = 1;
flag3 = 0;
}
switch(num1)
{
case 1: SendBYTE(green2_cycle[0]); break;
case 2: SendBYTE(green2_cycle[1]); break;
case 3: SendBYTE(green2_cycle[2]); break;
case 4: SendBYTE(green2_cycle[3]); break;
case 5: SendBYTE(green2_cycle[4]); break;
case 6: SendBYTE(green2_cycle[5]); break;
default:break;
} |