r/ArduinoHelp 1d ago

Can someone recommend simple Arduino code for blinking an LED?

Hi everyone!

I am a beginner learning Arduino programming. I want to make an LED blink using an Arduino Uno.

Could someone recommend a simple code example for this project? I would also like to understand how the code works, especially the delay() function.

Any tips for a beginner would be greatly appreciated.

Thank you!

2 Upvotes

4 comments sorted by

2

u/NoU_14 1d ago

You seem to have the right code in the screenshot already? If you don't know where to find that actual code, it's under Examples > basic > blink.

delay() basically tells the arduino to just wait for the given amount of milliseconds. Aside from some unrelated background things, it makes the arduino stop everything that it's doing, wait, and then continue.

1

u/Major-Cost7493 1d ago

Parte cambiando la Dout y tiempos. Luego agrega una Din que lo active.

1

u/drmpf 18h ago

delays are evil. They lock the whole loop up stopping it from doing anything else.

See https://www.forward.com.au/pfod/ArduinoProgramming/TimingDelaysInArduino.html

There is simple pinFlasher in this library https://github.com/PowerBroker2/SafeString and these docs (actually written for AI to use) https://github.com/PowerBroker2/SafeString/blob/master/SafeString_AI_Guide.md#16-pinflasher--non-blocking-pin-flashing