Professional Documents
Culture Documents
Part 1
EAS 199A, Fall 2010, Lecture 5
Gerald Recktenwald
Portland State University
gerry@me.pdx.edu
Overview
Discuss details, now that you had a taste
Arduino Environment
Basic code components
References
These notes borrow from
Basic Process
Design the circuit:
Build incrementally
Get the simplest piece to work first
Add complexity and test at each stage
Save and Backup frequently
Arduino interacts
with its environment
A
Serial communication
back to host
Arduino IDE
New sketch
IDE =
Integrated
Development
Environment
Open sketch
Save sketch
Upload sketch
Open Serial monitor
Tab
controls
http://www.arduino.cc/en/Guide/Environment
Code pane
Message pane
Arduino Programming: EAS 199A
Arduino IDE
New sketch
Open sketch
Save sketch
Upload sketch
Open Serial monitor
Tab
controls
http://www.arduino.cc/en/Guide/Environment
Arduino Programming: EAS 199A
http://www.arduino.cc/en/Guide/Environment
Language reference
http://arduino.cc/en/Reference/HomePage
Code tutorials
http://arduino.cc/en/Tutorial/HomePage
10
11
12
loop function is
repeated indefinitely
13
Code
pinMode(13, Output)
14
Code
digitalWrite(13, HIGH)
15
Code
delay(1000);
tells microcontroller to do
nothing for 1000 ms = 1 s
16
Code
digitalWrite(13, LOW)
17
int
float
double
char
Character values: a, b, D, 1
boolean
18
int red_LED_pin = 5;
Defines the variable type as an integer
Uses the value stored in red_LED_pin
19