sfchew7
Junior Member level 2
C LANGUAGE CODE PROBLEM
hi, I want to make the code below will in each condition will only execute printf 1 time. so how should I change it ?
thanks
hi, I want to make the code below will in each condition will only execute printf 1 time. so how should I change it ?
thanks
Code:
while(1)
{
if((input(pin_a0)==1) && (input(pin_a1)==1) && (input(pin_a2)==1))
{
delay_ms(1000);
lcd_putc("\fPL available:0");
delay_ms(1000);
printf("\fPL available:0");
delay_ms(1000);
}
else if((input(pin_a0)==0) && (input(pin_a1)==0) && (input(pin_a2)==0))
{
delay_ms(1000);
lcd_putc("\fPL available:3");
delay_ms(2000);
lcd_putc("\fPL1-empty");
lcd_putc("\nPL2-empty");
delay_ms(1000);
lcd_putc("\fPL3-empty");
delay_ms(1000);
printf("\fPL available:3");
delay_ms(1000);
}
}