SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Downloaden Sie, um offline zu lesen
table of contents:
microprocessor?
arduino?
example projects
composition
material
behavior
choreography
translator
urban agent
resources
output
input + output
what is a microchip? tiny, inexpensive, computer which can
interact with the physical world
feedback
sensors
microphone
infrared sensor
C02 sensor
compass
motor
LED
valve
speaker
actuators
μ chip
brain
=
programmed
behavior
0,86 €
what is a microchip?
hardware
“augmented” microchip
higher level
programming
+ +
very popular
(fora galore)
software community
what is an Arduino?
Arduino developement environement
BLINK
1. download arduino software (https://www.arduino.cc/en/Main/Software)
blink: software
2. plug in arduino to laptop with USB cable
5. select board > Arduino Genuino / UNO
3. run Arduino software
6. select COM Port > COMXX (windows) or dev/...Arduino Uno (Mac)
*Windows Device Driver install (Device Manager > Update Driver >
select Arduino/Drivers folder)
4. file > examples > basic > blink
syntax
functionName (argument 1, argument 2)
{
do something
between curly
brackets
}
semicolons for most line endings;
// comments after double slashes
/* comments
between
star slashes */
asked to choose a sketch folder name: this is where your Arduino sketch
will be stored. Name it Blinking_LED and click OK. Then, type the following
text (Example 01) into the Arduino sketch editor (the main window of
the Arduino IDE). You can also download it from www.makezine.com/
getstartedarduino. It should appear as shown in Figure 4-3.
// Example 01 : Blinking LED
#define LED 13 // LED connected to
// digital pin 13
void setup()
{
pinMode(LED, OUTPUT); // sets the digital
// pin as output
}
void loop()
{
digitalWrite(LED, HIGH); // turns the LED on
delay(1000); // waits for a second
digitalWrite(LED, LOW); // turns the LED off
delay(1000); // waits for a second
}
blink: software
comment
(for humans)
part of code
where we define
input/output pins
Required in every
Arduino sketch
main code which
will be repeated
over and over.
Required in every
Arduino sketch
do nothing for
1000 milliseconds
(one second)
do nothing for
1000 milliseconds
replace “LED”
with “13”
when compiled
set pin 13 to
OUTPUT
sets pin 13
to 5V
sets pin 13
to GND
*HIGH = 5V
LOW = 0V
language reference
blink: software uploading
Arduino Code Hex Code
compiling uploading
Microchip
Flash
memory
blink: hardware
analog in pins
microchip
digital in/out pins
power pins
USB
connector
reset
button
power
connector
discrete,
finite
smooth,
continuous
the real
world is
analog
microchips
are digital
analog vs digital
specialized pins
needs power (+)
can convert
analog to digital
can compare
voltages
Can talk to computers
has a clock
has reconfigurable
sensing and
actuating pins
can “interrupt”
itself
blink: hardware Arduino must be plugged in...
...to your computer,
in order to download
the code.
after being programmed:
(USB cable also supplies 5V)
can be battery powered
or plugged into wall
adapter (no longer needs
computer).
blink: the breadboard
power rails = horizontal
component
rails =
vertical
blink: hardware
physical object symbolic representation
blink: hardware
LED Polarity (the property of
having poles or being polar):
circuit symbol
Anode
Cathode
physical object
resistors do not have polarity
circuit symbol
physical object
sourcing vs sinking
upload blink (you may be asked to Save first) and the check console
blink: uploading!
blink: modifying software
change delay values...what happens?
Pulse Width Modulation (PWM)
microchips operate
faster than human
sensory apparatuses
human eyes can detect:
<60-90 Hz
human ears can detect:
20 - 20,000Hz
our microchip
runs at
16 MHz!!
blink: Thresholds of human perception
blink: modifying hardware
change LED for buzzer, what happens?
fade: modifying software
5V
0V
Time
Debugging Tips:
-the compile button
-display line numbers (File > Preferences)
-the serial monitor and serial printing (make sure same baud rate)
-isolate, test one thing at a time.
-metal connections are exposed on the bottom of
the board, beware of stray bits of metal or metal
tables.
-if your arduino is turning off right after turning
on, it’s probably shorting (ground and power are
connected).
diagnostic tools: mulitmeter & oscilloscope
measures voltage and current
at single location and time
multimeter oscilloscope
measures voltage and current
at multiple locations and times
BUTTON
button: hardware
// Example 03A: Turn on LED when the button is pressed
// and keep it on after it is released
#define LED 13 // the pin for the LED
#define BUTTON 7 // the input pin where the
// pushbutton is connected
int val = 0; // val will be used to store the state
// of the input pin
int state = 0; // 0 = LED off while 1 = LED on
void setup() {
pinMode(LED, OUTPUT); // tell Arduino LED is an output
pinMode(BUTTON, INPUT); // and BUTTON is an input
}
void loop() {
val = digitalRead(BUTTON); // read input value and store it
// check if the input is HIGH (button pressed)
// and change the state
if (val == HIGH) {
state = 1 - state;
}
if (state == 1) {
digitalWrite(LED, HIGH); // turn LED ON
} else {
digitalWrite(LED, LOW);
}
}
Now go test this code. You will notice that it works . . . somewhat. You’ll
declare an
INPUT too
if statement
checks a
condition and
executes the
proceeding
statement if the
condition is
“true”
*1 = TRUE
0 = FALSE
button: software
variable =
box for storage
hyperactive machine: debouncing
one button press = microscopic “bouncing” from the
								perspective of the microchip
introduce
multiple readings
taken at different
times to solve
the bouncing
probem
debounce: software
// Example 03B: Turn on LED when the button is pressed
// and keep it on after it is released
// Now with a new and improved formula!
#define LED 13 // the pin for the LED
#define BUTTON 7 // the input pin where the
// pushbutton is connected
int val = 0; // val will be used to store the state
// of the input pin
int old_val = 0; // this variable stores the previous
// value of "val"
int state = 0; // 0 = LED off and 1 = LED on
void setup() {
pinMode(LED, OUTPUT); // tell Arduino LED is an output
pinMode(BUTTON, INPUT); // and BUTTON is an input
}
void loop(){
val = digitalRead(BUTTON); // read input value and store it
// yum, fresh
// check if there was a transition
if ((val == HIGH) && (old_val == LOW)){
state = 1 - state;
}
old_val = val; // val is now old, let's store it
if (state == 1) {
digitalWrite(LED, HIGH); // turn LED ON
} else {
digitalWrite(LED, LOW);
}
}
stepper motors
servos
LCD display
potentiometer
humidity sensor
ultrasonic rangefinder
buttons
LEDs
temperature sensor
humidity sensor
our supplies today:
YOU DECIDE
stepper motors
potentiometers
humidity
IR rangefinder
LCD
temp
reuse existing code!
find code online and use it
if you’re a beginner, don’t bother
making anything from scratch just yet.
(The more popular the sensor/actuator
the easier this will be to find online)
Libraries
premade packages of software
procedures which save you time.
libraries provide extra
functionality for use in sketches,
e.g. working with hardware or
manipulating data.
1. Find thing you want to talk to
2. Find and download the library
3. Get experimenting!
eg. radio transmitter/reciever
Libraries
1. 3.
2. 4.
Libraries: installing
Try not to fry your Arduino yo
mosfet = electrically-controlled valve
mosfet = electrically-controlled valve
stepper motors
stepper motors
CD/DVD drives
CD/DVD drives
stepper motors
plotting machine foam cutting machine

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

publish manual
publish manualpublish manual
publish manual
 
Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino Course
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
 
Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)
 
Cassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshopCassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshop
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Day1
Day1Day1
Day1
 
Logic gate tester for IC's ( Digital Electronics and Logic deisgn EE3114 )
Logic gate tester for IC's ( Digital Electronics and Logic deisgn EE3114 )Logic gate tester for IC's ( Digital Electronics and Logic deisgn EE3114 )
Logic gate tester for IC's ( Digital Electronics and Logic deisgn EE3114 )
 
Arduino workshop sensors
Arduino workshop sensorsArduino workshop sensors
Arduino workshop sensors
 
Arduino projects &amp; tutorials
Arduino projects &amp; tutorialsArduino projects &amp; tutorials
Arduino projects &amp; tutorials
 
All about ir arduino - cool
All about ir   arduino - coolAll about ir   arduino - cool
All about ir arduino - cool
 
Buy arduino zero by robomart
Buy arduino zero by robomartBuy arduino zero by robomart
Buy arduino zero by robomart
 
How to measure frequency and duty cycle using arduino
How to measure frequency and duty cycle using  arduinoHow to measure frequency and duty cycle using  arduino
How to measure frequency and duty cycle using arduino
 
Analog and Digital Electronics Lab Manual
Analog and Digital Electronics Lab ManualAnalog and Digital Electronics Lab Manual
Analog and Digital Electronics Lab Manual
 
Starting with Arduino
Starting with Arduino Starting with Arduino
Starting with Arduino
 
Digital clock workshop
Digital clock workshopDigital clock workshop
Digital clock workshop
 
DSL Junior Makers - electronics workshop
DSL Junior Makers - electronics workshopDSL Junior Makers - electronics workshop
DSL Junior Makers - electronics workshop
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
 
Up and running with Teensy 3.1
Up and running with Teensy 3.1Up and running with Teensy 3.1
Up and running with Teensy 3.1
 

Ähnlich wie Arduino workshop

Robotics Session day 1
Robotics Session day 1Robotics Session day 1
Robotics Session day 1
Afzal Ahmad
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
SAURABHKUMAR892774
 
Arduino_UNO _tutorial_For_Beginners.pptx
Arduino_UNO _tutorial_For_Beginners.pptxArduino_UNO _tutorial_For_Beginners.pptx
Arduino_UNO _tutorial_For_Beginners.pptx
ANIKDUTTA25
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
HebaEng
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
Jayanthi Kannan MK
 

Ähnlich wie Arduino workshop (20)

Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 
Arduino
ArduinoArduino
Arduino
 
Robotics Session day 1
Robotics Session day 1Robotics Session day 1
Robotics Session day 1
 
IoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensorsIoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensors
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slides
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
 
Arduino.pptx
Arduino.pptxArduino.pptx
Arduino.pptx
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Electronz_Chapter_2.pptx
Electronz_Chapter_2.pptxElectronz_Chapter_2.pptx
Electronz_Chapter_2.pptx
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
 
Arduino_UNO _tutorial_For_Beginners.pptx
Arduino_UNO _tutorial_For_Beginners.pptxArduino_UNO _tutorial_For_Beginners.pptx
Arduino_UNO _tutorial_For_Beginners.pptx
 
Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011
 
Arduino comic v0004
Arduino comic v0004Arduino comic v0004
Arduino comic v0004
 
Hello Arduino.
Hello Arduino.Hello Arduino.
Hello Arduino.
 
Arduino electronics cookbook
Arduino electronics cookbookArduino electronics cookbook
Arduino electronics cookbook
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
 
How to use an Arduino
How to use an ArduinoHow to use an Arduino
How to use an Arduino
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 

Mehr von Jonah Marrs (8)

Sensors class
Sensors classSensors class
Sensors class
 
Arduino coding class part ii
Arduino coding class part iiArduino coding class part ii
Arduino coding class part ii
 
Arduino coding class
Arduino coding classArduino coding class
Arduino coding class
 
Arduino creative coding class part iii
Arduino creative coding class part iiiArduino creative coding class part iii
Arduino creative coding class part iii
 
Assembly class
Assembly classAssembly class
Assembly class
 
Shop bot training
Shop bot trainingShop bot training
Shop bot training
 
Microcontroller primer
Microcontroller primerMicrocontroller primer
Microcontroller primer
 
Eagle pcb tutorial
Eagle pcb tutorialEagle pcb tutorial
Eagle pcb tutorial
 

Kürzlich hochgeladen

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 

Kürzlich hochgeladen (20)

KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 

Arduino workshop

  • 1. table of contents: microprocessor? arduino? example projects composition material behavior choreography translator urban agent resources output input + output
  • 2. what is a microchip? tiny, inexpensive, computer which can interact with the physical world feedback sensors microphone infrared sensor C02 sensor compass motor LED valve speaker actuators μ chip brain = programmed behavior
  • 3. 0,86 € what is a microchip?
  • 4. hardware “augmented” microchip higher level programming + + very popular (fora galore) software community what is an Arduino?
  • 7. 1. download arduino software (https://www.arduino.cc/en/Main/Software) blink: software 2. plug in arduino to laptop with USB cable 5. select board > Arduino Genuino / UNO 3. run Arduino software 6. select COM Port > COMXX (windows) or dev/...Arduino Uno (Mac) *Windows Device Driver install (Device Manager > Update Driver > select Arduino/Drivers folder) 4. file > examples > basic > blink
  • 8. syntax functionName (argument 1, argument 2) { do something between curly brackets } semicolons for most line endings; // comments after double slashes /* comments between star slashes */
  • 9. asked to choose a sketch folder name: this is where your Arduino sketch will be stored. Name it Blinking_LED and click OK. Then, type the following text (Example 01) into the Arduino sketch editor (the main window of the Arduino IDE). You can also download it from www.makezine.com/ getstartedarduino. It should appear as shown in Figure 4-3. // Example 01 : Blinking LED #define LED 13 // LED connected to // digital pin 13 void setup() { pinMode(LED, OUTPUT); // sets the digital // pin as output } void loop() { digitalWrite(LED, HIGH); // turns the LED on delay(1000); // waits for a second digitalWrite(LED, LOW); // turns the LED off delay(1000); // waits for a second } blink: software comment (for humans) part of code where we define input/output pins Required in every Arduino sketch main code which will be repeated over and over. Required in every Arduino sketch do nothing for 1000 milliseconds (one second) do nothing for 1000 milliseconds replace “LED” with “13” when compiled set pin 13 to OUTPUT sets pin 13 to 5V sets pin 13 to GND *HIGH = 5V LOW = 0V
  • 11. blink: software uploading Arduino Code Hex Code compiling uploading Microchip Flash memory
  • 12. blink: hardware analog in pins microchip digital in/out pins power pins USB connector reset button power connector
  • 14. specialized pins needs power (+) can convert analog to digital can compare voltages Can talk to computers has a clock has reconfigurable sensing and actuating pins can “interrupt” itself
  • 15. blink: hardware Arduino must be plugged in... ...to your computer, in order to download the code. after being programmed: (USB cable also supplies 5V) can be battery powered or plugged into wall adapter (no longer needs computer).
  • 16. blink: the breadboard power rails = horizontal component rails = vertical
  • 17. blink: hardware physical object symbolic representation
  • 18. blink: hardware LED Polarity (the property of having poles or being polar): circuit symbol Anode Cathode physical object
  • 19. resistors do not have polarity circuit symbol physical object
  • 21. upload blink (you may be asked to Save first) and the check console blink: uploading!
  • 22. blink: modifying software change delay values...what happens? Pulse Width Modulation (PWM)
  • 23. microchips operate faster than human sensory apparatuses human eyes can detect: <60-90 Hz human ears can detect: 20 - 20,000Hz our microchip runs at 16 MHz!! blink: Thresholds of human perception
  • 24. blink: modifying hardware change LED for buzzer, what happens?
  • 26. Debugging Tips: -the compile button -display line numbers (File > Preferences) -the serial monitor and serial printing (make sure same baud rate) -isolate, test one thing at a time. -metal connections are exposed on the bottom of the board, beware of stray bits of metal or metal tables. -if your arduino is turning off right after turning on, it’s probably shorting (ground and power are connected).
  • 27. diagnostic tools: mulitmeter & oscilloscope measures voltage and current at single location and time multimeter oscilloscope measures voltage and current at multiple locations and times
  • 30. // Example 03A: Turn on LED when the button is pressed // and keep it on after it is released #define LED 13 // the pin for the LED #define BUTTON 7 // the input pin where the // pushbutton is connected int val = 0; // val will be used to store the state // of the input pin int state = 0; // 0 = LED off while 1 = LED on void setup() { pinMode(LED, OUTPUT); // tell Arduino LED is an output pinMode(BUTTON, INPUT); // and BUTTON is an input } void loop() { val = digitalRead(BUTTON); // read input value and store it // check if the input is HIGH (button pressed) // and change the state if (val == HIGH) { state = 1 - state; } if (state == 1) { digitalWrite(LED, HIGH); // turn LED ON } else { digitalWrite(LED, LOW); } } Now go test this code. You will notice that it works . . . somewhat. You’ll declare an INPUT too if statement checks a condition and executes the proceeding statement if the condition is “true” *1 = TRUE 0 = FALSE button: software variable = box for storage
  • 31. hyperactive machine: debouncing one button press = microscopic “bouncing” from the perspective of the microchip
  • 32. introduce multiple readings taken at different times to solve the bouncing probem debounce: software // Example 03B: Turn on LED when the button is pressed // and keep it on after it is released // Now with a new and improved formula! #define LED 13 // the pin for the LED #define BUTTON 7 // the input pin where the // pushbutton is connected int val = 0; // val will be used to store the state // of the input pin int old_val = 0; // this variable stores the previous // value of "val" int state = 0; // 0 = LED off and 1 = LED on void setup() { pinMode(LED, OUTPUT); // tell Arduino LED is an output pinMode(BUTTON, INPUT); // and BUTTON is an input } void loop(){ val = digitalRead(BUTTON); // read input value and store it // yum, fresh // check if there was a transition if ((val == HIGH) && (old_val == LOW)){ state = 1 - state; } old_val = val; // val is now old, let's store it if (state == 1) { digitalWrite(LED, HIGH); // turn LED ON } else { digitalWrite(LED, LOW); } }
  • 33. stepper motors servos LCD display potentiometer humidity sensor ultrasonic rangefinder buttons LEDs temperature sensor humidity sensor our supplies today:
  • 36. reuse existing code! find code online and use it if you’re a beginner, don’t bother making anything from scratch just yet. (The more popular the sensor/actuator the easier this will be to find online)
  • 37. Libraries premade packages of software procedures which save you time. libraries provide extra functionality for use in sketches, e.g. working with hardware or manipulating data.
  • 38. 1. Find thing you want to talk to 2. Find and download the library 3. Get experimenting! eg. radio transmitter/reciever Libraries
  • 40. Try not to fry your Arduino yo
  • 47. stepper motors plotting machine foam cutting machine