Go Down

Topic: Modifyed blink (Read 439 times) previous topic - next topic

Piti

But how do I do a break outside a loop?

AWOL

Do you mean function called "loop" or a while or for loop?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Piti

I mean  a break outside a loop (not function), a "for", "while" etc, what admit a break sentence.

lloyddean

Code: [Select]

const uint8_t           pinLED      = 13;

const uint8_t           LED_OFF     = LOW;
const uint8_t           LED_ON      = HIGH;
const unsigned long     HALF_SECOND = 500UL;


void loop()
{}

void setup()
{
    pinMode(pinLED, OUTPUT);     

    digitalWrite(pinLED, LED_OFF;

    int     loop_counter = 100;
    while ( loop_counter-- )
    {
        digitalWrite(pinLED, LED_ON);
        delay(HALF_SECOND);

        digitalWrite(pinLED, LED_OFF);
        delay(HALF_SECOND);
    }
}


Piti

Thank you, It's a bad habit inherited of BASIC programation.

Go Up