Is this a programing issue?

Hello everyone... I'm interested in turning the Arduino on... having a 10-second delay and providing power to a specific pin. Sounds simple enough. When I turn the Arduino on I'm getting a quick 2 click cycle to the pin activating it (pin 13 flashes twice quick before it enters the loop). Is this a programming issue? I've provided my code and if this doesn't make sense, I will attach a video:

// the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); digitalWrite(LED_BUILTIN, LOW); }

// the loop function runs over and over again forever void loop() { delay(13000); digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(3000); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(10000); // wait for a second }

The two quick blinks are the bootloader telling the PC - "Im here if you need me" If ou're using pin 13 for something else than an indicator - then you'll need to modify or remove the standard bootloader.

That was 100% the problem. I can’t thank you enough.

While I have you… currently when I come to the end of the loop I place the delay time at 10 minutes or more… allowing me to turn off when done. I’m sure this is simple programing (I’m learning). How do I get this code to step out of the loop and sit still?

int led = 13;
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(8, OUTPUT);

}
void loop() {
delay(10000);
digitalWrite (8, HIGH);
delay(5000);
digitalWrite (8, LOW);
delay(300000);

}
///////////////

It’s now time to step up to millis() timing. Once a delay() starts nothing else can happen until the delay has completed.

To effectively ‘stop’ the program, it is often done using

while(true):

To create an infinite loop.

There’s not much point exiting an Arduino sketch, because there’s nowhere to go.

If you want to run your code again - put it in a function, and call that whenever you need it - e.g. when a button is pressed.

I'm sure this is simple programing (I'm learning). How do I get this code to step out of the loop and sit still?

Your thinking is wrong!

The CPU MUST have a program to run. Programs written to run on the likes of the Uno do not end.

Mark

holmes4: Your thinking is wrong!

The CPU MUST have a program to run. Programs written to run on the likes of the Uno do not end.

Mark

But they certainly (effectively) CAN, if that's what the OP wants... Regards, Ray L.

jasonmagician: While I have you... currently when I come to the end of the loop I place the delay time at 10 minutes or more... allowing me to turn off when done. I'm sure this is simple programing (I'm learning). How do I get this code to step out of the loop and sit still?

First, use code tags.

Second, if you want that code to run once then do nothing forever, move it all into setup() and leave loop() blank.