• Skip to main content
  • Skip to primary sidebar

Homemade Circuit Projects

Get free circuit help 24/7

New Projects | Privacy Policy | About us | Contact | Disclaimer | Copyright | Videos 

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.

caution electricity can be dangerous

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:

You'll also like:

  • 1.  Over Current Cut-off Power Supply Using Arduino
  • 2.  Mobile Phone Controlled Robot Car Using DTMF Module
  • 3.  GSM Car Ignition and Central Lock Circuit Using Arduino
  • 4.  Wireless Servo Motor Control Using 2.4 GHz communication link
  • 5.  Color Detector Circuit with Arduino Code
  • 6.  Arduino Frequency Meter Using 16×2 Display

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!

Have Questions? Please Comment below to Solve your Queries! Comments must be Related to the above Topic!!

4 Comments
Newest
Oldest
Inline Feedbacks
View all comments

Primary Sidebar

Categories

  • 3-Phase Power (15)
  • 324 IC Circuits (19)
  • 4017 IC Circuits (52)
  • 4060 IC Circuits (26)
  • 555 IC Circuits (99)
  • 741 IC Circuits (20)
  • Arduino Engineering Projects (83)
  • Audio and Amplifier Projects (115)
  • Battery Chargers (83)
  • Car and Motorcycle (95)
  • Datasheets (74)
  • Decorative Lighting (Diwali, Christmas) (33)
  • Electronic Components (101)
  • Electronic Devices and Circuit Theory (36)
  • Electronics Tutorial (120)
  • Fish Aquarium (5)
  • Free Energy (34)
  • Fun Projects (13)
  • GSM Projects (9)
  • Health Related (20)
  • Heater Controllers (29)
  • Home Electrical Circuits (104)
  • How to Articles (20)
  • Incubator Related (6)
  • Industrial Electronics (28)
  • Infrared (IR) (40)
  • Inverter Circuits (98)
  • Laser Projects (12)
  • LED and Light Effect (93)
  • LM317/LM338 (21)
  • LM3915 IC (25)
  • Meters and Testers (66)
  • Mini Projects (150)
  • Motor Controller (67)
  • MPPT (7)
  • Oscillator Circuits (26)
  • PIR (Passive Infrared) (8)
  • Power Electronics (34)
  • Power Supply Circuits (79)
  • Radio Circuits (10)
  • Remote Control (48)
  • Security and Alarm (62)
  • Sensors and Detectors (121)
  • SG3525 IC (5)
  • Simple Circuits (75)
  • SMPS (29)
  • Solar Controllers (61)
  • Timer and Delay Relay (53)
  • TL494 IC (5)
  • Transformerless Power Supply (8)
  • Transmitter Circuits (41)
  • Ultrasonic Projects (16)
  • Water Level Controller (45)

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

© 2023 · Swagatam Innovations

wpDiscuz