ArduinoUNO PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

 Arduino UNO

Arduino Uno is an open-source microcontroller board based on the


ATmega328P microcontroller. It is designed to be easy to use and is a popular choice
for beginners in the field of electronics and programming. The board has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16
MHz ceramic resonator, a USB connection, a power jack, an ICSP header and a reset
button. It contains everything needed to support the microcontroller; simply connect it
to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get
started.

 Arduino IDE
The Arduino IDE is an open-source software, which is used to write and
upload code to the Arduino boards. The IDE application is suitable for different
operating systems such as Windows, Mac OS X, and Linux. It supports the
programming languages C and C++. Here, IDE stands for Integrated Development
Environment.

The program or code written in the Arduino IDE is often called as sketching.
We need to connect the Genuino and Arduino board with the IDE to upload the sketch
written in the Arduino IDE software. The sketch is saved with the extension '.ino.'
 Installation steps for Arduino IDE
Here are the steps to install the Arduino IDE on your computer:
1. Go to the official Arduino website at https://www.arduino.cc/en/software.
Click on the download link for your operating system (Windows, Mac, or
Linux).

2. Once the download is complete, run the installer file. Follow the prompts to
complete the installation.

3. When the installation is finished, launch the Arduino IDE.


 Sample Program to toggle LED in Arduino UNO
1. Go to Tools >> Board >> Arduino AVR Boards >> select Arduino Uno

2. Select the Port from Tools menu


3. Compile the code and click on upload to dump the code in Arduino Uno

4. Result
 Node MCU
NodeMCU is an open-source firmware and development kit that is based on
the ESP8266 WiFi module, which is widely used in IoT projects due to its easy
programming and low cost.

 Installation steps for Node MCU


Here are the steps to install the Node MCU on your computer:

1. Install the current upstream Arduino IDE at the 1.8.9 level or later. The current
version is on the Arduino website.
2. Start the Arduino IDE and open the Preferences window.

3. Enter https://arduino.esp8266.com/stable/package_esp8266com_index.json
into the File >>Preferences >>Additional Boards
4. Open Boards Manager from Tools >> Board menu and install esp8266
platform (and don't forget to select your ESP8266 board from Tools >> Board
menu after installation).
5. Go to Tools >> Board >> esp8266 >> select NodeMCU 1.0 (ESP-12E Module)

 Sample Program to toggle LED in Node MCU


1. Refer the Step 5 from installation for selecting the Node MCU board
2. Select Port from Tools menu
3. Compile the code and click on upload to dump the code in Node MCU

4. Results
 Code
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}

//The above code remains the same for both Arduino Uno and Node MCU

 Code explanation
1. void setup(): This is a special function that is called once when the Arduino
board is powered on or reset. It is used to initialize the board and the
connected devices.
2. pinMode(LED_BUILTIN, OUTPUT): This line sets the mode of the built-in
LED pin to OUTPUT. The LED_BUILTIN constant is defined by the Arduino
IDE and refers to the pin number of the built-in LED on the board.
3. void loop(): This is a special function that is called repeatedly while the
Arduino board is powered on. It is used to define the main program logic.
4. digitalWrite(LED_BUILTIN, HIGH): This line sets the LED_BUILTIN pin
to HIGH, which turns on the built-in LED.
5. delay(1000): This line causes the program to pause for 1000 milliseconds, or 1
second.
6. digitalWrite(LED_BUILTIN, LOW): This line sets the LED_BUILTIN pin
to LOW, which turns off the built-in LED.
Steps 4 to 6 are repeated indefinitely by the loop() function, causing the built-in LED
to blink on and off at a regular interval of 1 second.

You might also like