Intro To Arduino Ardu Block Lilypad
Intro To Arduino Ardu Block Lilypad
Brian Huang
Education Engineer
brian.huang@sparkfun.com
Pre-Class Survey
http://bit.ly/14Xk3Ek
Resources
This PPT
What is it?
Who cares?
What is it?
Hackers / Makers
Engineers
Artists
Musicians
Kids!
Teachers!!
You!!!
Physical Computing
Components, Silk Screen & Pins
What is all this???
the Brain
ATmega328
Temp.
Sensor
Light
Sensor
Buzzer /
Speaker
Actual Pin-outs
ArduBlock
Introduction to Programming
Scratch-like interface
Clear transition to text-based coding
Block Organization
Control
Block Organization
Pins
Block Organization
Numbers/Constants
Block Organization
Operators
Block Organization
Operators
Block Organization
Utilities
Block Organization
Utilities I2C
Understanding Input vs. Output
Referenced from the perspective of the microcontroller (electrical board).
Double-click on either
the Arduino Icon or
wherever you installed
(saved) the Arduino
program.
Plug it in
Lesson #0 – Configuring Arduino
1. Setup Board
(LilyPad Arduino w/ ATmega328)
2. Setup COM Port
PC – Highest COM #
Mac – /dev/tty.usbserial-A####xXx
Settings: Tools Board
Settings: Tools Serial Port
Other Board Types
Load ArduBlock
Lesson #0 – Test Upload
Check for Status Messages
Let’s get to hacking…
Turn
Turn Rinse &
Wait LED Wait
LED ON Repeat
OFF
Let’s get to hacking…
16 18 17
How are Analog Pins really
identified?
• Enumerate your
iterations – (e.g.
blink_10.adp,
blink_11.adp,
blink_12.adp…)
Concept: Analog vs. Digital
Microcontrollers are digital devices – ON or OFF.
Challenge 2a:
1) How do you turn on the RED LED?
2) Experiment with different values – what do you observe
happens?
3) How do you turn on the GREEN or the BLUE LED?
Color Mixing with 3 LEDs
Tri-color LED
Challenge 2c:
Create a unique lighting display that integrates a blink,
fade, or a switching of colors. Be prepared to have a
name for your art piece and show this to the rest of the
class.
Save your Project #2
Concept: If(), If() – else…
conditional logic
Concept: If(), If() – else…
conditional logic
A Simple Example
DIG
INPUT 2
What about
this??
A0 14 INPUT A5
INPUT A5
A1 15 (a.k.a. 19)
A2 16
A3 17
A4 18
A5 19
A6 20
digital Inputs
Buttons / Slide Switches
Same as
Pin A5
Challenge 3a:
Re-arrange the blocks or add new ones to:
• Turn ON an LED when the button is pressed.
• Otherwise blink continuously…
digital Inputs
Buttons / Slide Switches
Challenge 3b:
Now, using the button / switch – to start a disco/light changing
pattern
Challenge 3c:
Now, using the button / switch – to turn on and off the VIBE
motor.
Serial Monitor
Serial print
command
Any
message
“glue”
Data
Example
Open up Serial Monitor
Reading the
Light Sensor?
Challenge
Twinkle-Twinkle:
CC GG AA G FF EE DD C GG
Happy Birthday:
GGAGCBGGAGDCGGGECCBA
Hot Cross Buns:
B A G <> B A G <> G G G G <> A A A A B A G
Mary Had A Little Lamb:
B A G A BB B <> AA A <> BB B <>
B A G A BBBB AAA BAG.
Musical Notes / Frequencies
http://www.sparkfun.com
http://learn.sparkfun.com
http://www.arduino.cc
http://www.bildr.org
SparkFun Tutorials and Projects
- GardenBot:
www.sparkfun.com/news/598
- High Altitude Balloon:
www.sparkfun.com/tutorials/180
- GPS Clock:
www.sparkfun.com/tutorials/47
- Earthquake Data Logger:
www.sparkfun.com/tutorials/235
Thousands of Amazing ideas…
Thanks!
http://bit.ly/ZAmDMk
www.sparkfun.com
6175 Longbow Drive, Suite 200
Boulder, Colorado 80301
Buttons / Slide Switches
Digital Input, Pull-up Resistors, and
digitalRead()
DIG
INPUT
Buttons / Slide Switches
Digital Input, Pull-up Resistors, and
digitalRead()
DIG
INPUT