SlideShare a Scribd company logo
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?

More Related Content

Similar to Arduino Programming Basics (workshop #6)

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
vijaykumarsoni16
 
While loop
While loopWhile loop
While loop
RabiyaZhexembayeva
 
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...
imtiazalijoono
 
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
 
PYTHON.pptx
PYTHON.pptxPYTHON.pptx
PYTHON.pptx
studentsymposium
 
C# Async/Await Explained
C# Async/Await ExplainedC# Async/Await Explained
C# Async/Await Explained
Jeremy Likness
 
Programming with python
Programming with pythonProgramming with python
Programming with python
sarogarage
 
Python - Introduction
Python - IntroductionPython - Introduction
Python - Introduction
stn_tkiller
 
3 ilp
3 ilp3 ilp
Baabtra.com little coder chapter - 1
Baabtra.com little coder   chapter - 1Baabtra.com little coder   chapter - 1
Baabtra.com little coder chapter - 1
baabtra.com - No. 1 supplier of quality freshers
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino Programming
James Lewis
 
Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...
Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...
Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...
vitalikaush1
 
Loops
LoopsLoops
CNIT 126 9: OllyDbg
CNIT 126 9: OllyDbgCNIT 126 9: OllyDbg
CNIT 126 9: OllyDbg
Sam Bowne
 
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
 
Looping statements
Looping statementsLooping statements
Looping statements
AbhishekMondal42
 
python ppt.pptx
python ppt.pptxpython ppt.pptx
python ppt.pptx
ssuserd10678
 
Begin with c++ Fekra Course #1
Begin with c++ Fekra Course #1Begin with c++ Fekra Course #1
Begin with c++ Fekra Course #1
Amr Alaa El Deen
 
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-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptxQ-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptx
JeromeTacata3
 

Similar to 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
 
Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...
Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...
Kaush, Vitali - Title: Exploring the Power of V5 Sensors in Robotics: Enhanci...
 
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-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptxQ-SPractical_introduction_to_Python.pptx
Q-SPractical_introduction_to_Python.pptx
 

More from UNCG University Libraries

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)
UNCG University Libraries
 
Makerspace ehub workshops
Makerspace ehub workshops Makerspace ehub workshops
Makerspace ehub workshops
UNCG University Libraries
 
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)
UNCG University Libraries
 
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)
UNCG University Libraries
 
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
UNCG University Libraries
 
Circuit Basics (workshop #4)
Circuit Basics (workshop #4)Circuit Basics (workshop #4)
Circuit Basics (workshop #4)
UNCG University Libraries
 
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)
UNCG University Libraries
 
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
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
 
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
UNCG University Libraries
 
Tech Trends & Tutorial Project (LIS 631)
Tech Trends & Tutorial Project (LIS 631)Tech Trends & Tutorial Project (LIS 631)
Tech Trends & Tutorial Project (LIS 631)
UNCG University Libraries
 
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
UNCG University Libraries
 
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
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
 
Teaching Music Librarianship Online
Teaching Music Librarianship OnlineTeaching Music Librarianship Online
Teaching Music Librarianship Online
UNCG University Libraries
 
Records Management at UNCG
Records Management at UNCGRecords Management at UNCG
Records Management at UNCG
UNCG University Libraries
 
Neo Black Society History Presentation
Neo Black Society History PresentationNeo Black Society History Presentation
Neo Black Society History Presentation
UNCG University Libraries
 
Campus life in 1913
Campus life in 1913Campus life in 1913
Campus life in 1913
UNCG University Libraries
 
Beyond power point
Beyond power pointBeyond power point
Beyond power point
UNCG University Libraries
 
Assessment101
Assessment101 Assessment101

More from 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
 

Recently uploaded

Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
christianmathematics
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
ArianaBusciglio
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 

Recently uploaded (20)

Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 

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!