• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Homemade Circuit Projects

Get free circuit help 24/7

  • 1000+ Circuits
  • Privacy Policy
  • About Us
  • Contact
  • Disclaimer
  • Videos – Circuit Test Results
You are here: Home / Arduino Engineering Projects / Blinking an LED with Delay – Arduino Basics

Blinking an LED with Delay – Arduino Basics

Last Updated on March 13, 2019 by Swagatam

Here we learn the bare minimum code for compiling an Arduino and also the method of blinking an LED using an Arduino board.

Learning the Bare Basics

Here we discus and try to understand the fundamental minimum code that one would need to compile an “Arduino Sketch” which consists the setup()method and the loop()method.

The only required Hardware for this is an Arduino Board, no additional circuit board is required.

The setup() function is rendered as soon as a “sketch” is initiated. We enforce it in order to set forth the variables, pin modes, begin involving libraries, etc.

The setup operation is assigned for executing just once, every time the Arduino board is switched ON or is reset.

Once you develop a setup() functionality, the loop()function executes exactly what its named after, that is it begins looping successively, providing a chance to your program to alter and respond as it runs and moves ahead.

Code which comes under the loop() section of your “sketch” is enforced to vibrantly take control of the Arduino board.

The compiler will not read all those lines which might begin with a couple of slashes (//), which indicates that you are supposed to write your code only after this.

Expressing your code in this form ensures ease of explaining the folks who may be reading it, as well to yourself regarding how the program could be proceeding in a step by step manner.

 

 






Blinking an LED with Arduino

Here we learn regarding the most basic electronic circuit operation that one can execute using an Arduino board, yes it’s about blinking an LED through a code.

The only additional device other than an Arduino board that you would require is an - LED.

To begin with the procedure, you need to connect a 330 ohm ¼ watt resistor to pin#13 of the board.

Next, connect the LED with this 330 ohms resistor and ground (long lead goes to 330 ohm while the shorter lead to ground).Now hook up the Arduino board with your computer, initialize the program and feed the code tha’s presented later on this page.

Traditionally Arduinos would have an LED connected across its pin#13, which starts blinking when powered without any hardware involved.

 

Implementing the Code

In order to implement the code, the first execution would be to toggle pin#13 to form an output pinout with the line:

pinMode(13, OUTPUT);
Across the main loop, we switch ON the LED through the line:

digitalWrite(13, HIGH);

The above enables a 5V supply to pin#13 so that I generates the required potential across the LED, illuminating it.

Now we switch it OFF using the following line:

digitalWrite(13, LOW);

Yeah, logically this reverts pin#13 to zero, switching OFF the LED.

Now in between the above ON and OFF of the LEDs we would require a certain time delay gap, so that the blinking makes sense and becomes recognizable.

The code delay() commands Arduino to remain stationery until a second, in other words this command mutes
the operations for a second.

The Code:




Previous: Electronic Scoreboard Circuit Using IC 4033 Counter
Next: Customized Water Flow Controller with Timer Circuit

About Swagatam

I am an electronic engineer (dipIETE ), hobbyist, inventor, schematic/PCB designer, manufacturer. I am also the founder of the website: https://www.homemade-circuits.com/, where I love sharing my innovative circuit ideas and tutorials.
If you have any circuit related query, you may interact through comments, I'll be most happy to help!

You'll also like:

  • 1.  Raspberry Pi Explained
  • 2.  LCD 220V Mains Timer Circuit – Plug and Play Timer
  • 3.  Color Detector Circuit with Arduino Code
  • 4.  Wireless Office Call Bell Circuit
  • 5.  Digital Capacitance Meter Circuit Using Arduino
  • 6.  Wireless Servo Motor Control Using 2.4 GHz communication link

Please Subscribe (Only if you are Genuinely Interested in our Newsletters)


 

Reader Interactions

Comments

  1. Search Related Posts for Commenting

  2. Mitchell Perumal says

    Hi SWA. I'm considering buying an arduino. It a Mega 2560 r3 with a starter kit. could you advise if its a reasonable choice to begin with. also can u use multiple inputs to activate their own sub-procedures at the same time Or assign varying interrupt level for certain inputs. Thank U.

    • Swagatam says

      Hi Mitchell, I am not so well versed with Arduinos, so won't be able to suggest correctly.

    • VIJAY AJ says

      Hi perumal, I suggest arduino uno is the best and cheapest one when you are at starting stage. First of all you try with arduino uno when you studied all the process such as spi,i2c,LCD,xbee e.t.c interfacing using arduino uno then you move for arduino mega….I got a clone version of arduino uno from Amazon at 450rs….it works well

  3. shadab karnachi says

    I have atmega32,
    can we control 4 motors using atmega 32?



  4. COMMENT BOX IS MOVED AT THE TOP


Primary Sidebar

Electronic Projects Categories

  • 3-Phase Power (15)
  • 324 IC Circuits (19)
  • 4017 IC Circuits (51)
  • 4060 IC Circuits (25)
  • 555 IC Circuits (92)
  • 741 IC Circuits (18)
  • Amplifiers (49)
  • Arduino Engineering Projects (82)
  • Audio Projects (83)
  • Battery Chargers (75)
  • Car and Motorcycle (87)
  • Datasheets (44)
  • Decorative Lighting (Diwali, Christmas) (31)
  • DIY LED Projects (81)
  • Electronic Components (96)
  • Electronic Devices and Circuit Theory (34)
  • Electronics Tutorial (99)
  • Fish Aquarium (5)
  • Free Energy (34)
  • Games (2)
  • GSM Projects (9)
  • Health Related (17)
  • Heater Controllers (23)
  • Home Electrical Circuits (98)
  • Incubator Related (6)
  • Industrial Electronics (25)
  • Infrared (IR) (39)
  • Inverter Circuits (94)
  • Laser Projects (10)
  • LM317/LM338 (21)
  • LM3915 IC (24)
  • Meters and Testers (52)
  • Mini Projects (152)
  • Motor Controller (64)
  • MPPT (7)
  • Oscillator Circuits (12)
  • PIR (Passive Infrared) (8)
  • Power Electronics (32)
  • Power Supply Circuits (64)
  • Radio Circuits (9)
  • Remote Control (46)
  • Security and Alarm (55)
  • Sensors and Detectors (115)
  • SG3525 IC (4)
  • Simple Circuits (72)
  • SMPS (30)
  • Solar Controllers (60)
  • Timer and Delay Relay (51)
  • TL494 IC (5)
  • Transformerless Power Supply (8)
  • Transmitter Circuits (36)
  • Ultrasonic Projects (12)
  • Water Level Controller (45)

Follow Homemade Circuits

Facebook
Twitter
YouTube
Instagram
My Facebook-Page
Quora

Feeds

Post RSS
Comment RSS

Circuit Calculators

  • AWG to Millimeter Converter
  • Battery Back up Time Calculator
  • Capacitance Reactance Calculator
  • IC 555 Astable Calculator
  • IC 555 Monostable Calculator
  • Inductance Calculator
  • LC Resonance Calculator
  • LM317, LM338, LM396 Calculator
  • Ohm’s Law Calculator
  • Phase Angle Phase Shift Calculator
  • Power Factor (PF) Calculator
  • Reactance Calculator
  • Small Signal Transistor(BJT) and Diode Quick Datasheet
  • Transistor Astable Calculator
  • Transistor base Resistor Calculator
  • Voltage Divider Calculator
  • Wire Current Calculator
  • Zener Diode Calculator

© 2021 · Swagatam Innovations

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok