how to blink led only 5 times

Discussion in 'Programmer's Corner' started by ugeshkumar, Sep 11, 2016.

  1. ugeshkumar

    Thread Starter New Member

    Nov 27, 2015
    16
    0
    hi
    i want to blink the led only 5 times, when i press switch, i need logic only using pic
    please do the needfull
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,736
    4,789
    Sounds like homework.

    What have YOU done to try to solve the problem?
     
  3. ugeshkumar

    Thread Starter New Member

    Nov 27, 2015
    16
    0

    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);
    }
    }
    }
     
  4. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,802
    832
    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?
     
Loading...