You are on page 1of 16

Introduction to Arduino

• Arduino Uno Board


Construction
• Arduino Uno Programming
• Flashing Example
COMPONENTS OF THE
ARDUINO
Arduino Board Features
MCU :Atmaga 328
Input Voltage :7V-12V
Operating Voltage :5V
CPU Speed :16 MHZ
Digital I/O :14
PWM :6
Analog Input :6
Analog Output :0
EEPROM :1KB
SRAM :2K Byte
Flash ROM :32K Byte
UART :1
USB :1
USB LED Digital I/O
Interface Connected Connections
chip to Pin 13 Transmit (TX)
Reset LED
Button Receive (RX)
LED

USB
Port
Serial
Cryst Programmi
ng
al
Connector
5V
regulato Microcontroll
er
r
(Atmega
328)
Power
(7-12V DC
input) Analog
Power
Connector Inputs
Power USB
Input Programming Port

LED connected
to Pin 13

13
12
11
Power 10
Pin 9
8 Digital
7
6
Input/
A0 5 Output
A1 4
Analog A2 3
Input A3 2
A4 1
A5 0

• pins 3,5,6,9,10 & 11 can used as PWM (pulse with


modulation) (Analog output)
Basics of C Programming

void setup() {
Write the initialization
}

void loop() {
Write the repeated program
}

// comment
; at end of instruction

pinMode(Pin No., OUTPUT); // program pin 13 as output


digitalWrite(Pin No., HIGH); // output HIGH on Pin 13
delay(No.); // wait in a m s
‘Blink’ example
code:

void setup() {
// initialize digital pin LED_BUILTIN (Pin 13) as an output.
pinMode(13, OUTPUT);
}

void loop() {
// the loop function runs over and over again forever

digitalWrite(13, HIGH); // turn the LED on (HIGH is the


voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the
voltage LOW
delay(1000); // wait for a second
}
Blink Example
From file Select
Examples
Uploading to Arduino

Upload the program


on Arduino
LED will
Flasher
Change the Code!
• Try changing the delay time
from 1000 to 200
(milliseconds)
• Can you make the code work
from pin 9 instead of pin 13?
• What else can you do to
change the code?
Flashing 2
LEDs LED 1 on &LED 2
off
then
LED 1 on &LED 2
off
void setup() {

pinMode(7, OUTPUT); //Pin 7 is defined as output


pinMode(8, OUTPUT); //Pin 8 is defined as output
}
void loop() {

digitalWrite(7, HIGH); //turn on the LED on pin 7


digitalWrite(8, LOW); //turn off the LED on pin 87
delay(1000); //wait for 1000 milliseconds

digitalWrite(7, LOW); / /turn off the LED on pin 7


digitalWrite(8, HIGH); //turn on the LED on pin 8
delay(1000); //wait for 1000 milliseconds
}
Adding a switch to the
circuit
3. File  Examples  01.Basic  Bare Minimum
Type the following code into the Bare Minimum sketch and save it
on your desktop as Touch Lamp. Upload it and try it out!
Make a
Touch
Lamp

You might also like