SlideShare a Scribd company logo
1 of 20
PHYSICAL PROTOTYPING
© 2011 K3 Creative Commons v3.0 SA-NC
Lab 1: Inputs & Outputs
With the Arduino prototyping board
ARDUINO, WHAT IS THAT?
Image taken from booklet by M. Banzi et al.2
Image taken from booklet by M. Banzi et al.
FEEL IT, TINKER
3
JUNK IS GOLD
Image taken from booklet by M. Banzi et al.4
ARDUINO USB - LAYOUT
ANALOG PINS 0 TO 5POWER OUTPUTS
RESET SWITCH
POWER CONNECTOR
6 v – 24 v
USB CONNECTOR
DIGITAL PINS 0 TO 13
5
DOWNLOAD & INSTALL
Download the IDE from:
http://www.arduino.cc
Make sure you download
the right version for
your operating system
6
The IDE
IDE stands for Integrated
Development Environment
Arduino's IDE is completely based
on the Processing IDE since
September 2005
Using the IDE is a 3-step process:
1) Write your code
2) Compile the code
3) Upload to Arduino
7
FILE MENU
NEW, SAVE, OPEN,
EXAMPLES…
EDIT MENU
CUT, PASTE, FIND…
TOOLS MENU
COM-PORT SETTINGS,
TOOLS,
BOARD TYPE
8
9
OPEN SKETCH
VERIFY / COMPILE
NEW SKETCH
SAVE SKETCH
UPLOAD
SERIAL MONITOR
Variables are containers for values.
You can give a variable any name you
like.
The value of a variable can be
changed and used dynamically as
many times as you like.
Variables are good to use when you
use values more than once in your
program.
Arduino Uno has 32 kilobytes of flash
memory and can store up to 1024
bytes as variables.
Code structure
Variable declaration
10
The Setup method is used to initiate
the board before the code gets
executed.
This code runs only once when the
reset button has been pressed.
It defines if pins should be used as
inputs or outputs, whether serial
communication is going to be used,
etc.
Code structure
The setup method
11
The loop is where the action is!
This is where you write your program
It executes from top to bottom, line by
line, and then starts over (looping back).
Code structure
The program loop
12
How to hook up your Arduino to your computer
Check the communication port (COM port)
Windows: COMXX ,
Linux: /dev/ttyUSBXX,
MAC: /dev/cu.usbserial-AXXX.
Did it install correctly?
COM-port number? (remember the port's identity)
Choose right COM port in IDE
Open “LED Blink” example under Examples/1. Basics
Compile and upload to Arduino
A built-in LED at pin 13 should blink
Check out the code and see if you can change the interval
QUICK START-GUIDE
13
BREADBOARD LAYOUT
Image taken from booklet by M. Banzi et al.14
The center grid is connected in this way
The outer sides are connected in this way
Current (A): is the number of electrons per time and section of cable
Voltage (V): is the difference in the number of electrons between two
points, It only exists in relative terms!, thus we have to “share grounds”
when interconnecting circuits
Resistance (R): reduces the flow of electrons
Current always takes the easiest possible way
If it has the option to pass through cable or resistor, it chooses the cable
In series connection
Rtotal = R1 + R2
A parallel connection
Rtotal = (R3*R4) / (R3+R4)
Voltage, Current & Resistance
15
Buttons
Hook up a ”push button” as shown in this diagram:
PRACTICAL EXAMPLE
16
Common Arduino methods:
pinMode(pin, MODE);
 Sets pin (”pin”) in a specific mode, INPUT or OUTPUT
 Normally used in the setup.
digitalWrite(pin, HIGH/LOW);
 Will set one of the digital pins on the Arduino board to be either
HIGH (5V) or LOW (0V).
int digitalRead(pin);
 Will read one of the digital pins on the Arduino board and will
answer either HIGH (5V) or LOW (0V).
if(statement) {block_code1} else {block_code2};
 If the conditional statement is met, block_code1 will run, otherwise
block_code2 will be executed.
for (init; end; increment) {}
 Will execute a certain piece of code a certain amount of times.
PROGRAMMING
17
for(counter=0; counter<end; counter++){}
1)The FOR loop is a software construct that will execute a
block of code a number of times.
2)The code will be looped until a certain condition is met
3)FOR loops are constructed with an initialization value, a
boolean statement, and a counting statement
4)We use them to iterate a certain action a determined
amount of times
counter initialization
FOR LOOP
condition counter
increment / decrement
18
VARIABLES
Predefined Data Types
There are three different variable types:
1) INT – 16 BIT, (-32768 TO 32767)
Port numbers, values read from ports, results from
calculations...
2) CHAR – 8 BIT (1 BYTE), (0 TO 256)
Letters (A-Z), Small values, not suited for calculations,
sending data serially...
3) LONG – 32 BIT, (-2147483648 TO 2147483647)
Results from calculations, counting milliseconds...
The type of variable determines the maximum size of the value
Use the appropriate variable types, because of limited memory
Use variable names that make sense!
NOT myVariable, myValue, port...
INSTEAD firstInput, nbrOfOutputs...
19
HOMEWORK: KNIGHT RIDER
Implement the light effect as seen in
KIT, the Knight Rider car
from the iconic 80's TV series
with David Hasselhoff
The light sequence should be activated
when a user presses a button.
20

More Related Content

What's hot

ARDUINO AND ITS PIN CONFIGURATION
 ARDUINO AND ITS PIN  CONFIGURATION ARDUINO AND ITS PIN  CONFIGURATION
ARDUINO AND ITS PIN CONFIGURATIONsoma saikiran
 
برمجة الأردوينو - اليوم الأول
برمجة الأردوينو - اليوم الأولبرمجة الأردوينو - اليوم الأول
برمجة الأردوينو - اليوم الأولAhmed Sakr
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduinoMakers of India
 
Interface stepper motor through Arduino using LABVIEW.
Interface stepper motor through Arduino using LABVIEW.Interface stepper motor through Arduino using LABVIEW.
Interface stepper motor through Arduino using LABVIEW.Ankita Tiwari
 
Distance measurement using Ultrasonic sensor on Arduino Uno
Distance measurement using Ultrasonic sensor on Arduino UnoDistance measurement using Ultrasonic sensor on Arduino Uno
Distance measurement using Ultrasonic sensor on Arduino UnoAswin KP
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينوsalih mahmod
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to ArduinoQtechknow
 
Embedded systems الانظمة المدمجة
Embedded systems  الانظمة المدمجة Embedded systems  الانظمة المدمجة
Embedded systems الانظمة المدمجة salih mahmod
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the ArduinoWingston
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshopatuline
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3Jeni Shah
 
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 arduinoSagar Srivastav
 
Arduino slides
Arduino slidesArduino slides
Arduino slidessdcharle
 
Introduction to arduino!
Introduction to arduino!Introduction to arduino!
Introduction to arduino!Makers of India
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming FamiliarizationAmit Kumer Podder
 
All about ir arduino - cool
All about ir   arduino - coolAll about ir   arduino - cool
All about ir arduino - coolVlada Stoja
 

What's hot (20)

Arduino Programming
Arduino ProgrammingArduino Programming
Arduino Programming
 
ARDUINO AND ITS PIN CONFIGURATION
 ARDUINO AND ITS PIN  CONFIGURATION ARDUINO AND ITS PIN  CONFIGURATION
ARDUINO AND ITS PIN CONFIGURATION
 
برمجة الأردوينو - اليوم الأول
برمجة الأردوينو - اليوم الأولبرمجة الأردوينو - اليوم الأول
برمجة الأردوينو - اليوم الأول
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduino
 
Interface stepper motor through Arduino using LABVIEW.
Interface stepper motor through Arduino using LABVIEW.Interface stepper motor through Arduino using LABVIEW.
Interface stepper motor through Arduino using LABVIEW.
 
Distance measurement using Ultrasonic sensor on Arduino Uno
Distance measurement using Ultrasonic sensor on Arduino UnoDistance measurement using Ultrasonic sensor on Arduino Uno
Distance measurement using Ultrasonic sensor on Arduino Uno
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Embedded systems الانظمة المدمجة
Embedded systems  الانظمة المدمجة Embedded systems  الانظمة المدمجة
Embedded systems الانظمة المدمجة
 
Arduino
ArduinoArduino
Arduino
 
Lab2ppt
Lab2pptLab2ppt
Lab2ppt
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
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
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
 
Introduction to arduino!
Introduction to arduino!Introduction to arduino!
Introduction to arduino!
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming Familiarization
 
All about ir arduino - cool
All about ir   arduino - coolAll about ir   arduino - cool
All about ir arduino - cool
 

Similar to Physical prototyping lab1-input_output (2)

Similar to Physical prototyping lab1-input_output (2) (20)

Indroduction arduino
Indroduction arduinoIndroduction arduino
Indroduction arduino
 
Indroduction the arduino
Indroduction the arduinoIndroduction the arduino
Indroduction the arduino
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Ch_2_8,9,10.pptx
Ch_2_8,9,10.pptxCh_2_8,9,10.pptx
Ch_2_8,9,10.pptx
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Arduino: Arduino starter kit
Arduino: Arduino starter kitArduino: Arduino starter kit
Arduino: Arduino starter kit
 
Embedded L1_notes_unit2_architecture.pptx
Embedded L1_notes_unit2_architecture.pptxEmbedded L1_notes_unit2_architecture.pptx
Embedded L1_notes_unit2_architecture.pptx
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
 
Hello Arduino.
Hello Arduino.Hello Arduino.
Hello Arduino.
 
Aurdino presentation
Aurdino presentationAurdino presentation
Aurdino presentation
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Embedded system application
Embedded system applicationEmbedded system application
Embedded system application
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
 
Arduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic ArduinoArduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic Arduino
 
Getting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialGetting Started With Arduino_Tutorial
Getting Started With Arduino_Tutorial
 
arduino
arduinoarduino
arduino
 
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
 

Recently uploaded

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Physical prototyping lab1-input_output (2)

  • 1. PHYSICAL PROTOTYPING © 2011 K3 Creative Commons v3.0 SA-NC Lab 1: Inputs & Outputs With the Arduino prototyping board
  • 2. ARDUINO, WHAT IS THAT? Image taken from booklet by M. Banzi et al.2
  • 3. Image taken from booklet by M. Banzi et al. FEEL IT, TINKER 3
  • 4. JUNK IS GOLD Image taken from booklet by M. Banzi et al.4
  • 5. ARDUINO USB - LAYOUT ANALOG PINS 0 TO 5POWER OUTPUTS RESET SWITCH POWER CONNECTOR 6 v – 24 v USB CONNECTOR DIGITAL PINS 0 TO 13 5
  • 6. DOWNLOAD & INSTALL Download the IDE from: http://www.arduino.cc Make sure you download the right version for your operating system 6
  • 7. The IDE IDE stands for Integrated Development Environment Arduino's IDE is completely based on the Processing IDE since September 2005 Using the IDE is a 3-step process: 1) Write your code 2) Compile the code 3) Upload to Arduino 7
  • 8. FILE MENU NEW, SAVE, OPEN, EXAMPLES… EDIT MENU CUT, PASTE, FIND… TOOLS MENU COM-PORT SETTINGS, TOOLS, BOARD TYPE 8
  • 9. 9 OPEN SKETCH VERIFY / COMPILE NEW SKETCH SAVE SKETCH UPLOAD SERIAL MONITOR
  • 10. Variables are containers for values. You can give a variable any name you like. The value of a variable can be changed and used dynamically as many times as you like. Variables are good to use when you use values more than once in your program. Arduino Uno has 32 kilobytes of flash memory and can store up to 1024 bytes as variables. Code structure Variable declaration 10
  • 11. The Setup method is used to initiate the board before the code gets executed. This code runs only once when the reset button has been pressed. It defines if pins should be used as inputs or outputs, whether serial communication is going to be used, etc. Code structure The setup method 11
  • 12. The loop is where the action is! This is where you write your program It executes from top to bottom, line by line, and then starts over (looping back). Code structure The program loop 12
  • 13. How to hook up your Arduino to your computer Check the communication port (COM port) Windows: COMXX , Linux: /dev/ttyUSBXX, MAC: /dev/cu.usbserial-AXXX. Did it install correctly? COM-port number? (remember the port's identity) Choose right COM port in IDE Open “LED Blink” example under Examples/1. Basics Compile and upload to Arduino A built-in LED at pin 13 should blink Check out the code and see if you can change the interval QUICK START-GUIDE 13
  • 14. BREADBOARD LAYOUT Image taken from booklet by M. Banzi et al.14 The center grid is connected in this way The outer sides are connected in this way
  • 15. Current (A): is the number of electrons per time and section of cable Voltage (V): is the difference in the number of electrons between two points, It only exists in relative terms!, thus we have to “share grounds” when interconnecting circuits Resistance (R): reduces the flow of electrons Current always takes the easiest possible way If it has the option to pass through cable or resistor, it chooses the cable In series connection Rtotal = R1 + R2 A parallel connection Rtotal = (R3*R4) / (R3+R4) Voltage, Current & Resistance 15
  • 16. Buttons Hook up a ”push button” as shown in this diagram: PRACTICAL EXAMPLE 16
  • 17. Common Arduino methods: pinMode(pin, MODE);  Sets pin (”pin”) in a specific mode, INPUT or OUTPUT  Normally used in the setup. digitalWrite(pin, HIGH/LOW);  Will set one of the digital pins on the Arduino board to be either HIGH (5V) or LOW (0V). int digitalRead(pin);  Will read one of the digital pins on the Arduino board and will answer either HIGH (5V) or LOW (0V). if(statement) {block_code1} else {block_code2};  If the conditional statement is met, block_code1 will run, otherwise block_code2 will be executed. for (init; end; increment) {}  Will execute a certain piece of code a certain amount of times. PROGRAMMING 17
  • 18. for(counter=0; counter<end; counter++){} 1)The FOR loop is a software construct that will execute a block of code a number of times. 2)The code will be looped until a certain condition is met 3)FOR loops are constructed with an initialization value, a boolean statement, and a counting statement 4)We use them to iterate a certain action a determined amount of times counter initialization FOR LOOP condition counter increment / decrement 18
  • 19. VARIABLES Predefined Data Types There are three different variable types: 1) INT – 16 BIT, (-32768 TO 32767) Port numbers, values read from ports, results from calculations... 2) CHAR – 8 BIT (1 BYTE), (0 TO 256) Letters (A-Z), Small values, not suited for calculations, sending data serially... 3) LONG – 32 BIT, (-2147483648 TO 2147483647) Results from calculations, counting milliseconds... The type of variable determines the maximum size of the value Use the appropriate variable types, because of limited memory Use variable names that make sense! NOT myVariable, myValue, port... INSTEAD firstInput, nbrOfOutputs... 19
  • 20. HOMEWORK: KNIGHT RIDER Implement the light effect as seen in KIT, the Knight Rider car from the iconic 80's TV series with David Hasselhoff The light sequence should be activated when a user presses a button. 20

Editor's Notes

  1. Encourage people to interrupt you so you can help them immediately. Explain they do you a favor. It’s good to time the duration of the presentation.
  2. In this course you will not learn in a traditional academic way. We believe that you can learn electronics
  3. Recycle old electronics. Modern electronics is based on 30 year old technology. Mention shelf in corridor. Leave crap take crap
  4. Explain the 5 comments. Digital pins operate in 0’s and 1’s On or Off. Analog pins work as inputs. Explain link between Arduino and computer: Arduino is able to get control electrical components like LED’s and speakers and Arduino is able to measure values in the physical world. Measure inputs control outputs 3.3 volts and 5 volt power pins to power electrical components (sensors and actuators) Vin = maximum 17 volts. Vin is the power from an external power source, used to power motors for example. Arduino takes between 6 and 17 volts The worst thing that could happen is you fry the chip on the Arduino board.
  5. Talk about programming languages: Compile into machine code, 0’s and 1’s Arduino syntax is a mix of C and C#. It’s a third level language. Uploading: the process of taking the code and putting it on the arduino board. The code stays there until new code is uploaded.
  6. All Arduino programs are called sketches. Heritage from Processing environment. Processing was a sketchpad. Tools menu: COM-port. Set the right port to use the USB port the Arduino is connected to. Linux: TTY1 or TTY0 Windows: COM4 etc. next one COM5 (unique numbers) OSX: TTY-USB Serial modem. Always the first one in the list. Board type: Set correct model. (UNO) They have different kinds of firmware and bootloaders.
  7. Explain Verify/Compile and Upload Monitor: Window to receive and send message from and to the computer (serial)
  8. Don’t spend too much time on this slide. Cooky jar analogy. Variables are containers, you can put stuff in them and give them a name. Sock drawer: Friday socks , Tuesday socks, etc. 1: Always put your variables on top of everything else.
  9. 2: Setup. In every program you write there have to be two functions: Setup and Loop Setup kicks off a program. For instance declare which pins you will use. From the start Arduino doesn’t know how you want to use them, you have to tell it. It has to know where to direct power to or on which pin to listen for information. The setup only runs once. The arduino runs code line by line, this is why semicolons are used.
  10. 3: The loop. This is where you write your program. It executes line by line. When it reaches the bottom it starts over again. You can skip parts of the code with some special statements. The point of looping everything over and over again is because we can’t predict the real world. For instance when someone will press a button. So we keep checking.
  11. Windows: Plugin: Show where the driver is and install it. OSX + Linux should work out fine. When kids are done before others ask them to make the LED blink like a heart beat. Slide 14: Explain what the breadboard is. Normally you solder connections. But it’s a pain in the ass to do this all the time. Breadboard is used to quickly test if things work before you actually produce it. Explain the horizontal and vertical lines. And how power is distributed among them. Tell them not to remove the sticker on the back of the breadboard
  12. Tell them about current voltage and resistance. Explain the water analogy. Electricity works as water. When you push it through a garden hose the hose acts as resistance. Same as a wire, it reduces the amount of electrons transfers. Voltage is the speed of the water and the electricity. When you try to put too much water through the hose it will burst. Same goes for electricity. Important: Ground. Power always has to go back to the source it came from. This is ground. Skip the part about series and parallel connections. In the bottom corner is the schematic of how to connect a button. We will never be this technical in the workshop.
  13. When you do push the button you open up a connection to ground. Electricity always takes the easiest route back to the power source. Ground is easier than the other connection. Write the code as a live coding session
  14. Quick recap on code examples. Explain the for loop. Make a loop out of the blink LED code. Use for loop to loop blinking 25 times. Explain benefits of for loop, repetition of code.
  15. Explain the three parameters.
  16. Explain there are 3 kinds. Name your variables properly, give them a name that describes what it does or which information it holds.
  17. Show youtube movie of Knight Rider intro song. Explain the concept of a ground ditch. Encourage them to ‘cheat’, to make a function out of the blinking led code for the knight rider example. Give them an explanation of the homework assignment in next class.