0% found this document useful (0 votes)
15 views

1.2 Arduino Introduction_Exp 1

The document outlines the MCE1030 course on Arduino and IoT, covering the Arduino platform, its components, and the Arduino IDE interface. It includes details on coding structure, syntax, and a practical experiment involving an LED blink. The course aims to provide hands-on experience in embedded systems and programming fundamentals using Arduino.

Uploaded by

aadi.sureka35
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

1.2 Arduino Introduction_Exp 1

The document outlines the MCE1030 course on Arduino and IoT, covering the Arduino platform, its components, and the Arduino IDE interface. It includes details on coding structure, syntax, and a practical experiment involving an LED blink. The course aims to provide hands-on experience in embedded systems and programming fundamentals using Arduino.

Uploaded by

aadi.sureka35
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

Course Code: MCE1030

Course Name: Arduino, IoT FAB Lab.

ARDUINO and Arduino IDE Interface

Department of Mechatronics | SAMM


Faculty of Engineering | Manipal University Jaipur
Contents

• Introduction

• Components

• IDE Tool

• IDE Interface

• Coding Structure

• Coding Syntax
Introduction

Learn by Doing – Sense, Control & Actuate

• Embedded Systems
• Arduino Basics
• Arduino Architecture
• Arduino board layout. What are the resources available
• Arduino IDE
• Programming fundamentals

3
Components

Arduino Uno
1. Power In (Barrel Jack): Can be used with either a 9V or 12V wall-wart or battery

2. Power In (USB Port): Provides power and communicates with your board when plugged
into your computer via USB.

3. LED (RX: Receiving): Lights up when the Arduino is receiving data (such as when being
programmed).

4. LED (TX: Transmitting): Lights up when your Arduino is transmitting data (such as
when running a program).
Components

5. LED (Pin 13: Troubleshooting): LED is incorporated into your sketch to show if your
program is running properly.

6. Pins (ARef, Ground, Digital, Rx, Tx): Used for inputs, outputs, power, and ground.

7. LED (Indicates Arduino is ON): Simple power indicator LED.

8. Reset button: Used to manually reset Arduino, which makes code restart.

9. ICSP Pins: For “in-circuit serial programming,” used if you want to bypass the
bootloader.

10. Pins (Analog In, Power In, Ground, Power Out, Reset): Used for inputs, outputs,
power, and ground.
Components

Arduino Basics
arduino ( arrr-dween-oh )

(n.) It's an open-source physical computing platform based


on a simple microcontroller board, and a development
environment for writing software for the board.
Components

Types of Arduino Boards

Arduino Nano

Arduino Mega
Arduino LilyPad

Arduino Uno
Arduino Mini
Arduino Leonardo
Components

Arduino Uno

Digital pins:
• 14 digital IO pins
• 6 are PWM pins (3, 5, 6, 9, 10, and 11).

Analog pins:
• 6 analog pins(A0, A1, A2, A3, A4, and
A5)
• Takes analog values as an input
Components
IDE Tool

Arduino IDE
VERIFY SERIAL
MONITOR
UPLOAD
NEW TAB
OPEN CODE GOES
SAVE HERE
BOARD &
SERIAL PORT
SELECTIONS
Interfaces – IDE Tool

Download Arduino IDE


(Integrated Development Environment)

arduino.cc/en/main/software
Interfaces – IDE Tool

Connect RedBoard to your


Computer
Interfaces – IDE Tool

Install Arduino Drivers


Interfaces – IDE Tool

OPEN Arduino IDE


Interfaces – IDE Tool

Select your Board


Interfaces – IDE Tool

Select Serial Port (Windows)


Interfaces – IDE Tool

Select Serial Device (Mac)


Interfaces – IDE Tool

KNOW the Arduino GUI


Verify:
Compiles and
approves your
code. Will catch
errors in syntax.
Interfaces – IDE Tool

KNOW the Arduino GUI


Upload: Sends
your code to the
Arduino Board.
When you clicked
it, you should see
lights on your
board blink rapidly.
Interfaces – IDE Tool

KNOW the Arduino GUI

New:
Open-up a
new code
window tab.
IDE Interfaces

KNOW the Arduino GUI


Open: Open an
existing sketch,
which is where you
write your code.
IDE Interfaces

KNOW the Arduino GUI

Save: Saves
the currently
open sketch.
IDE Interfaces

KNOW the Arduino GUI

Serial Monitor:
Opens a window that
displays any serial
info the Board is
transmitting. Very
useful for debugging.

What is Serial?
Process of sending
data one bit (0 or
1) at a time.
IDE Interfaces

KNOW the Arduino GUI

Sketch
Name: Name of
the sketch you are
currently working
on.
IDE Interfaces

KNOW the Arduino GUI

Code Area:
Area where you
compose the code
for your sketch.
IDE Interfaces

KNOW the Arduino GUI

Message
Area: Where
the IDE tells you
if there were any
errors in your
code.
Coding Structure

Basic Coding structure

4
Coding Structure

Basic Coding structure


 setup() function
• Called when a sketch starts.
• To initialize variables, pin modes, start using libraries, etc.
• Will only run once, after each power-up or reset of the
Arduino board.
 loop() function
• Loops consecutively.
• Code in the loop() section of the sketch is used to actively
control the Arduino board.
 Commenting
• Any line that starts with two slashes (//) will not be read by
the compiler, so you can write anything you want after it.
Coding Syntax

 pinMode()  digitalRead()
• Instruction used to set the mode (INPUT or • Reads the value from a specified digital pin,
OUTPUT) in which we are going to use a either HIGH or LOW
pin.
• Eg: int inPin=7;
• Eg: pinMode (13, OUTPUT);
val = digitalRead(inPin);
• ie. setting pin13 as output. • ie. reads the value from inPin and assigns it to
val.
 digitalWrite()  delay()
• Write a HIGH or a LOW value to a digital • Pauses the program for the amount of time (in
pin. milliseconds) specified as a parameter.
• Eg: digitalWrite (11, HIGH); • Eg: delay(1000);
• ie. setting pin 11 to high. • ie. waits for a second (1000 ms = 1 s)

29
Experiment 1 Onboard LED Blink

Run the Blink Code


 Follow the steps in Arduino IDE as shown below : 1 // the setup function runs once when you press reset
• File ▸ Examples ▸ 01. Basics ▸ Blink 2 // or power the board
3 void setup() {
4 // initialize digital pin LED_BUILTIN as an output.
5 pinMode(LED_BUILTIN, OUTPUT);
6}
7
8 // the loop function runs over and over again forever
9 void loop() {
10 digitalWrite(LED_BUILTIN, HIGH); // turn the LED
on (HIGH is the voltage level)
11 delay(1000); // wait for a second
12 digitalWrite(LED_BUILTIN, LOW); // turn the LED
off by making the voltage LOW
13 delay(1000); // wait for a second
14 }
30
Circuit diagram for Experiment 1

 Refer the Circuit diagram provided


 Draw the circuit diagram in Lab file.
 Don’t paste any figures in the Lab file

Figure 1. Circuit diagram of LED blink with Arduino Uno

31
V

Thank You!

You might also like