SlideShare ist ein Scribd-Unternehmen logo
1 von 11
THIRTY MINUTES TO 
MAKING: 
ARDUINO BASICS: PROGRAMMING
PARTS! (SAME AS LAST SESSION) 
• Arduino 
• Components (LEDs, resistors, etc.) 
• Your brain
ARDUINO CODE 
• Based upon C/C++ 
• Programs created and uploaded to the Arduino 
are called sketches. 
• Sketches can be created in notepad or other 
text editors.
LAST SESSION’S LESSON 
• We made an LED blink. 
• We turned it on, waited, and then turned it off. 
• Doing this fast enough made it appear to 
blink.
THIS SESSION? 
• We will work an array of blinking LEDs. 
• By controlling the order, the array appears to 
be sweeping. 
• We will start with explicitly turning each LED 
on and then off. 
• …then we will do the same with loops.
WHAT ARE LOOPS? 
• A loop performs a task repeatedly until a 
condition is met. 
• Some loops are based upon incrementing or 
decrementing a variable. 
• Remember, the base code in an Arduino sketch 
uses a loop – void loop()
FOR LOOP? 
• A FOR loop performs a task for as long as the 
condition is met. 
• Usually in the format: 
• Set a variable equal to some number. 
• Make sure the variable is less than (or greater than) 
another number. 
• Perform a mathematical operation (usually addition 
or subtraction) on the variable to change its value. 
• Start over.
A FOR LOOP LOOKS LIKE: 
• for(int i = 1; i < 10; i = i + 1){ repeated actions } 
• int i = 1 
• Set the variable ‘i’ equal to 1. 
• You don’t have to use ‘i’ if you don’t want to do so. Choose 
one that makes sense to you, but be consistent. 
• i < 10 
• We are only going to do the actions inside of the curly braces 
{} 
for as long as i is less than 10. 
• We will keep repeating these actions until i equals 9. 
• Once i equals 10, the loop stops before anything happens. 
• i = i + 1 
• Once we have run through the loop with i equal to 1, we will 
start over with i equals 2.
WHY LOOPS? 
• Because we are lazy inherently efficient. 
• Type a short command many times -or-a 
medium command once. 
• Speaking of lazy: 
• i = i + 1 can be written i++ 
• i = i - 1 can be written i-- 
• (why press five buttons when three will do?) 
• Like this: 
For (int i = 1; i < 10; i++){}
SEE IT IN ACTION!
QUESTIONS?

Weitere ähnliche Inhalte

Ähnlich wie Arduino Programming Basics (workshop #6)

Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfQ-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Michpice
 
Programming with python
Programming with pythonProgramming with python
Programming with python
sarogarage
 
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docxCMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
monicafrancis71118
 
Lesson 304 05 jan14-1500-ay
Lesson 304 05 jan14-1500-ayLesson 304 05 jan14-1500-ay
Lesson 304 05 jan14-1500-ay
Codecademy Ren
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
Q-Step_WS_02102019_Practical_introduction_to_Python.pptxQ-Step_WS_02102019_Practical_introduction_to_Python.pptx
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
nyomans1
 

Ähnlich wie Arduino Programming Basics (workshop #6) (20)

Step Count Method for Time Complexity Analysis.pptx
Step Count Method for Time Complexity Analysis.pptxStep Count Method for Time Complexity Analysis.pptx
Step Count Method for Time Complexity Analysis.pptx
 
While loop
While loopWhile loop
While loop
 
Loop Introduction for Loop while Loop do while Loop Nested Loops Values of...
Loop Introduction for Loop  while Loop do while Loop  Nested Loops  Values of...Loop Introduction for Loop  while Loop do while Loop  Nested Loops  Values of...
Loop Introduction for Loop while Loop do while Loop Nested Loops Values of...
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfQ-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
 
PYTHON.pptx
PYTHON.pptxPYTHON.pptx
PYTHON.pptx
 
C# Async/Await Explained
C# Async/Await ExplainedC# Async/Await Explained
C# Async/Await Explained
 
Programming with python
Programming with pythonProgramming with python
Programming with python
 
Python - Introduction
Python - IntroductionPython - Introduction
Python - Introduction
 
3 ilp
3 ilp3 ilp
3 ilp
 
Baabtra.com little coder chapter - 1
Baabtra.com little coder   chapter - 1Baabtra.com little coder   chapter - 1
Baabtra.com little coder chapter - 1
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino Programming
 
Loops
LoopsLoops
Loops
 
CNIT 126 9: OllyDbg
CNIT 126 9: OllyDbgCNIT 126 9: OllyDbg
CNIT 126 9: OllyDbg
 
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docxCMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
CMIS 102 Hands-On Lab Week 4OverviewThis hands-on lab all.docx
 
Looping statements
Looping statementsLooping statements
Looping statements
 
python ppt.pptx
python ppt.pptxpython ppt.pptx
python ppt.pptx
 
Begin with c++ Fekra Course #1
Begin with c++ Fekra Course #1Begin with c++ Fekra Course #1
Begin with c++ Fekra Course #1
 
Lesson 304 05 jan14-1500-ay
Lesson 304 05 jan14-1500-ayLesson 304 05 jan14-1500-ay
Lesson 304 05 jan14-1500-ay
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
Q-Step_WS_02102019_Practical_introduction_to_Python.pptxQ-Step_WS_02102019_Practical_introduction_to_Python.pptx
Q-Step_WS_02102019_Practical_introduction_to_Python.pptx
 
Q-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptxQ-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptx
 

Mehr von UNCG University Libraries

Makerspace @uncg libraries presentation for LIS688 (june 2014)
Makerspace @uncg libraries presentation for LIS688 (june 2014)Makerspace @uncg libraries presentation for LIS688 (june 2014)
Makerspace @uncg libraries presentation for LIS688 (june 2014)
UNCG University Libraries
 
NCLA 2013 Presentation by Mary Jane Conger "Three to Get Ready...Migration"
NCLA 2013 Presentation by Mary Jane Conger "Three to Get Ready...Migration"NCLA 2013 Presentation by Mary Jane Conger "Three to Get Ready...Migration"
NCLA 2013 Presentation by Mary Jane Conger "Three to Get Ready...Migration"
UNCG University Libraries
 

Mehr von UNCG University Libraries (20)

Arduino Programming Basics - step by step screenshots (workshop #6)
Arduino Programming Basics - step by step screenshots (workshop #6) Arduino Programming Basics - step by step screenshots (workshop #6)
Arduino Programming Basics - step by step screenshots (workshop #6)
 
Makerspace ehub workshops
Makerspace ehub workshops Makerspace ehub workshops
Makerspace ehub workshops
 
Arduino Introduction (Blinking LED) Presentation (workshop #5)
Arduino  Introduction (Blinking LED)  Presentation (workshop #5)Arduino  Introduction (Blinking LED)  Presentation (workshop #5)
Arduino Introduction (Blinking LED) Presentation (workshop #5)
 
Arduino Introduction (Blinking LEDs) - step by step screenshots (workshop #5)
Arduino Introduction (Blinking LEDs) - step by step screenshots  (workshop #5)Arduino Introduction (Blinking LEDs) - step by step screenshots  (workshop #5)
Arduino Introduction (Blinking LEDs) - step by step screenshots (workshop #5)
 
A History of African Americans at UNCG
A History of African Americans at UNCGA History of African Americans at UNCG
A History of African Americans at UNCG
 
Circuit Basics (workshop #4)
Circuit Basics (workshop #4)Circuit Basics (workshop #4)
Circuit Basics (workshop #4)
 
3D Design Basics with inkscape and tinkercad (workshops #3)
3D Design Basics with inkscape and tinkercad (workshops #3)3D Design Basics with inkscape and tinkercad (workshops #3)
3D Design Basics with inkscape and tinkercad (workshops #3)
 
Makers, making, and makerspaces online workshop #1
Makers, making, and makerspaces online workshop #1  Makers, making, and makerspaces online workshop #1
Makers, making, and makerspaces online workshop #1
 
Makerspace @uncg libraries presentation for LIS688 (june 2014)
Makerspace @uncg libraries presentation for LIS688 (june 2014)Makerspace @uncg libraries presentation for LIS688 (june 2014)
Makerspace @uncg libraries presentation for LIS688 (june 2014)
 
Tech Tool Thursday: Quick and free visual tools in 30 minutes
Tech Tool Thursday:   Quick and free visual tools in 30 minutesTech Tool Thursday:   Quick and free visual tools in 30 minutes
Tech Tool Thursday: Quick and free visual tools in 30 minutes
 
Tech Trends & Tutorial Project (LIS 631)
Tech Trends & Tutorial Project (LIS 631)Tech Trends & Tutorial Project (LIS 631)
Tech Trends & Tutorial Project (LIS 631)
 
Tech Tool Thursday: Pinterest in 30 minutes
Tech Tool Thursday: Pinterest in 30 minutesTech Tool Thursday: Pinterest in 30 minutes
Tech Tool Thursday: Pinterest in 30 minutes
 
Tech Tool Thursday: Free Visual Tools online workshop
Tech Tool Thursday: Free Visual Tools online workshopTech Tool Thursday: Free Visual Tools online workshop
Tech Tool Thursday: Free Visual Tools online workshop
 
NCLA 2013 Presentation by Mary Jane Conger "Three to Get Ready...Migration"
NCLA 2013 Presentation by Mary Jane Conger "Three to Get Ready...Migration"NCLA 2013 Presentation by Mary Jane Conger "Three to Get Ready...Migration"
NCLA 2013 Presentation by Mary Jane Conger "Three to Get Ready...Migration"
 
Teaching Music Librarianship Online
Teaching Music Librarianship OnlineTeaching Music Librarianship Online
Teaching Music Librarianship Online
 
Records Management at UNCG
Records Management at UNCGRecords Management at UNCG
Records Management at UNCG
 
Neo Black Society History Presentation
Neo Black Society History PresentationNeo Black Society History Presentation
Neo Black Society History Presentation
 
Campus life in 1913
Campus life in 1913Campus life in 1913
Campus life in 1913
 
Beyond power point
Beyond power pointBeyond power point
Beyond power point
 
Assessment101
Assessment101 Assessment101
Assessment101
 

Kürzlich hochgeladen

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 

Kürzlich hochgeladen (20)

PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

Arduino Programming Basics (workshop #6)

  • 1. THIRTY MINUTES TO MAKING: ARDUINO BASICS: PROGRAMMING
  • 2. PARTS! (SAME AS LAST SESSION) • Arduino • Components (LEDs, resistors, etc.) • Your brain
  • 3. ARDUINO CODE • Based upon C/C++ • Programs created and uploaded to the Arduino are called sketches. • Sketches can be created in notepad or other text editors.
  • 4. LAST SESSION’S LESSON • We made an LED blink. • We turned it on, waited, and then turned it off. • Doing this fast enough made it appear to blink.
  • 5. THIS SESSION? • We will work an array of blinking LEDs. • By controlling the order, the array appears to be sweeping. • We will start with explicitly turning each LED on and then off. • …then we will do the same with loops.
  • 6. WHAT ARE LOOPS? • A loop performs a task repeatedly until a condition is met. • Some loops are based upon incrementing or decrementing a variable. • Remember, the base code in an Arduino sketch uses a loop – void loop()
  • 7. FOR LOOP? • A FOR loop performs a task for as long as the condition is met. • Usually in the format: • Set a variable equal to some number. • Make sure the variable is less than (or greater than) another number. • Perform a mathematical operation (usually addition or subtraction) on the variable to change its value. • Start over.
  • 8. A FOR LOOP LOOKS LIKE: • for(int i = 1; i < 10; i = i + 1){ repeated actions } • int i = 1 • Set the variable ‘i’ equal to 1. • You don’t have to use ‘i’ if you don’t want to do so. Choose one that makes sense to you, but be consistent. • i < 10 • We are only going to do the actions inside of the curly braces {} for as long as i is less than 10. • We will keep repeating these actions until i equals 9. • Once i equals 10, the loop stops before anything happens. • i = i + 1 • Once we have run through the loop with i equal to 1, we will start over with i equals 2.
  • 9. WHY LOOPS? • Because we are lazy inherently efficient. • Type a short command many times -or-a medium command once. • Speaking of lazy: • i = i + 1 can be written i++ • i = i - 1 can be written i-- • (why press five buttons when three will do?) • Like this: For (int i = 1; i < 10; i++){}
  • 10. SEE IT IN ACTION!