How to Upload a Code to an Arduino Board using Arduino IDE and About an Arduino Blink. for beginners

How to..

In the previous post, we talked about what Arduino is and what we need to know about the Arduino. And we talked about how to connect an Arduino board to a computer properly. If you don't know what Arduino is, read that post first.
img-alt

Today I'm talking about how to upload code to an Arduino board. First of all, you need to have a simple understanding of the Arduino IDE. Check out this image.

explaining arduino IDE
download as PDF
Now connect your Arduino board to your computer. Check that the Arduino is properly connected to the IDE.

Then, if you want to upload code, you need to know how to write code. The simplest code that can be used in Arduino is "blink code".

Let go to write it and upload it.

void setup() {
  pinMode(13,OUTPUT); //Transferring the 13th pin as an output 
}
void loop() {
digitalWrite(13,HIGH); //Turn on the 13th digital pin
delay(1000); //1 second delay
digitalWrite(13,LOW); //Turn off the 13th digital pin
delay(1000); //1 second delay
}
blink code



Here is the blink code. This is called a blink. When this is uploaded to the board, the voltage of a pin changes over time.

void setup() {}
void loop() {}
This separates the entire code into two parts. Here, a code written in void setup () {} works only once. But if you write code in "void loop () {}", it will work again and again.

pinMode(13,OUTPUT);
If you look at the Arduino board, its pin is numbered. The 13th pin is written as output by this code.


digitalWrite(13,HIGH);
digitalWrite(13,LOW);
The "HIGH" to increase the voltage of a pin and "LOW" to reduce the voltage.
"digital" is used to name a pin digitally. Similarly, a pin is used as an analog to name an analog. The "Write" command is used to execute a named pin.
The executable pin is specified as "13". 13 is the 13th digital pin of the Arduino board. To identify the analog pin, it is marked "~" in front of the pin.

delay(1000);
Delay specifies how long the pin should remain on or off. In Arduino Code, 1 to 1000 seconds is recorded. Accordingly, the Delay in the above code is one second.
When this code is executed, the 13th pin will be switched on and off in seconds. If you attach a bulb to this pin, it will blink. So, this code is called the blink code.


  1. End in Arduino ";" Application is mandatory.
  2. // This is a comment or / * This is a comment * / Use this comment. When writing code, write in {}.
  3. Capital is used for words that begin with a simple and middle word.
  4. Eg - digitalWrite (8, HIGH);.
  5. Be very careful about Capital and Simple.


Now you can upload this code. Click on the Upload button on the software. Within seconds the code will be uploaded to the board.
After uploading, you can see how blinking LED on the board. because It connected to the 13th digital pin.
blink led with aduino uno board with Blink code

If not, connect the 13th pin to an LED. Check out the image below.
how connect led to arduino uno board

download as PDF
Make some changes to the code and try. Then you can easily understand the code and write new code.
There is much more to talk about. See you in the next post. If there is a problem, leave a comment below.

No comments

Powered by Blogger.