I want to program PIC18F such that with push button 1 pressed, the relay/LED is on for 1 sec, off for 2 sec continuously unless button 2 pressed , in which relay/LED will be on for 2.5 sec and off for 5 sec. How to achieve this? I tried giving delay (as given below) but when i press RD1 it does not recognize. I want PIC to change timing whenever i press other button.
while(1)
{
if(PORTD.RD0==0)
{
PORTB.RB0=1;
delay_ms(2500);
PORTB.RB1=0;
delay_ms(5000);
if(PORTD.RD1==0)
{
//condition of while RD0 becomes false
//start a different delay
}
}
}