How to Program Arduino (Blinking LED) - Ryzen Hunt

programming an Arduino and blinking a LED.
How to Program Arduino (Blinking LED) - Ryzen Hunt

Programming an Arduino

Hello friends, many of the students, that are new to Arduino, always ask, "how to program an Arduino?" Here I have explained how you can program an Arduino with an example project.

Before you start programming our Arduino you need to set up an environment first. First, you need to install the Arduino IDE. To more about setting up your environment click here.

When you open your Arduino IDE, you'll find two major functions are written over there:
  • void setup()
  • void loop()
Before getting started, we need to know about these two functions.

1. void setup()

This function runs only once, after each power up or reset of Arduino. This function is called in the starting of your code and is used to initialize the variables, and to define pin modes etc.

2. void loop()

This function works as its name suggests. This function runs again and again (loops) until power off. This function actively controls the Arduino board.


Example: Blinking LED

Circuit Diagram


Here we used one LED, one 220K Ω resistance and one breadboard with Arduino Uno (you can use any of the Arduino, know more types of Arduino click here).
LED's positive terminal is connected to digital-pin 13 and negative terminal is connected to the Ground pin through a resistance. Now we need to open our Arduino IDE and write our source code.



Source Code







In the above code, first we defined the digital-pin 13 as a variable named led (you can give any name or you can ignore this line just write 13 at every place in the functions below). Then in setup function we defined pinMode (pin number 13 as OUTPUT) so we can get output on the pin 13. In the loop function first we made our pin HIGH and gave a delay of 1 second and then made that pin LOW and again gave a delay of 1 second. As this whole piece of code is written in a function called loop so this will run again and again and led will blink until the Arduino Board is powered.




Hope you learned something new here. Please share this with your friends and Don't forget to share your comments and valuable suggestions and feedback. If you have any question or doubt then plz ask, we would answer in our next post.
For visiting our Python Course Seriesclick here and for HTML Course Series click here.

You may like these posts

  1. To insert a code use <i rel="pre">code_here</i>
  2. To insert a quote use <b rel="quote">your_qoute</b>
  3. To insert a picture use <i rel="image">url_image_here</i>