Intro To Arduino
Intro To Arduino
of Arduino
Arduino Board
• Created in Ivrea, Italy in 2005 by Massimo Banzi & David Cuartielles
• Open Source Hardware
• Coding is accessible & transferrable (C++, Processing, java)
Arduino…
http://spectrum.ieee.org/geek-life/hands-on/the-making-of-arduino
PWR IN USB
(to Computer)
RESET
SCL\SDA
(I2C Bus)
POWER
5V / 3.3V / GND
Digital I\O
PWM(3, 5, 6, 9, 10, 11)
Analog
INPUTS
Go ahead and plug your board in!
SIK Components
Name Image Type Function Notes
Push Button Digital Input Switch - Closes Polarized, needs
or opens circuit resistor
Trim Analog Input Variable resistor Also called a
Trimpot.
potentiometer
Photoresistor Analog Input Light Dependent Resistance varies
Resistor (LDR) with light.
Relay Digital Output Switch driven by Used to control
a small signal larger voltages
Temp Sensor Analog Input Temp Dependent
Resistor
Flex Sensor Analog Input Variable resistor
Vertical columns –
called power bus are
connected vertically
Using the Breadboard to built a simple
circuit
What happens
when you break
the circuit?
What if you
wanted to add
more than one
LED?
Adding control – let’s use the Arduino
and start programming!!!
Concepts: INPUT vs. OUTPUT
Microcontroller (electrical board).
Inputs is a signal / Output is any signal
information going into exiting the board.
the board.
5V 5V
0V 0V
Open up Arduino
Hints:
For PC Users
1.Create a folder under C:\Program Files (x86)
called Arduino. Move the entire Arduino
program folder here.
Arduino
Integrated Development Environment (IDE)
void setup()
{
// runs once
}
void loop()
{
// repeats
error & status messages }
Settings: Tools Serial Port
Your computer
communicates to the
Arduino microcontroller via
a serial port through a
USB-Serial adapter.
digitalRead()
analogRead()
Serial communication
Let’s get to coding…
Project #1 – Blink
“Hello World” of Physical Computing
Turn
Turn Rinse &
Wait LED Wait
LED ON Repeat
OFF
Comments, Comments, Comments
Comments are for you – the programmer and
your friends…or anyone else human that
might read your code.
pinMode(pin, INPUT/OUTPUT);
ex: pinMode(13, OUTPUT);
digitalWrite(pin, HIGH/LOW);
ex: digitalWrite(13, HIGH);
delay(time_ms);
ex: delay(2500); // delay of 2.5 sec.
Move the
green wire
from the
power bus to
pin 13 (or any
other Digital
I/O pin on the
Arduino board.
A few simple challenges
Let’s make LED#13 blink!
Challenge 1a – blink with a 200 ms second
interval.
Variable Scope
Global
---
Function-level
Programming Concepts: Variable Types
Variable Types:
analogWrite(pin, val);
RESET
SCL\SDA
(I2C Bus)
POWER
5V / 3.3V / GND
Digital I\O
PWM(3, 5, 6, 9, 10, 11)
Analog
INPUTS