how to blink led only 5 times

Thread Starter

ugeshkumar

Joined Nov 27, 2015
16
Sounds like homework.

What have YOU done to try to solve the problem?

I tried using for Loop , I don't know how to do.
Example: RB0=1 connecting switch
Rb1 connecting led
While(1)
{
If((RB0==1))
{
For(i=0; i<=5; i=I+1)
{
RB1=1;
__delay_ms(100);
RB1=0;
__delay_ms(100);
}
}
}
 

djsfantasi

Joined Apr 11, 2010
9,237
And what is the behavior you observe?

Note that in the absence of other errors, this will not blink the LED only five times. Do you see why?
 
Top