xanseviera
Junior Member level 3
Code:
do{
if(kbhit())
{mydata=getch();
mystat=1;}
if(mystat==1)
{
if(mydata=='a' || mydata=='A') // Junction 1
{
//green at junction 1
output_high(PIN_D5);
output_low(PIN_D6);
output_low(PIN_D7);
output_low(PIN_E2); //<--- how to terminate this during execution of mydata=='a'
}
mystat=0;
}
else if (mystat==0)
{
//junction 1
if(input(PIN_E2)==0)
{
//green
output_high(PIN_D5);
output_low(PIN_D6);
output_low(PIN_D7);
junction2();
delay_ms(2000);
//yellow
output_high(PIN_D6);
output_low(PIN_D7);
output_low(PIN_D5);
delay_ms(2000);
//red
output_high(PIN_D7);
output_low(PIN_D6);
}
}
while(1);
guys,
my problem is... when 'mydata=='a'' is running, at the same time PIN_E2 have an input, PIN_E2 will execute the task.
i need help in my programming, during 'mydata=='a'' is running, i want to make sure that PIN_E2 didn't work even it has an input.
but PIN_E2 can work outside 'if statement'.