SlideShare a Scribd company logo
Lesson-4-Arduino-Programming-dsBasics.pdf
WHAT IS A PROGRAM
 is a written programming language which enables a computer to
perform its function. Therefore, a program is a written instruction that
process input, manipulate data, and output a result.
Arduino uses C / C++ Programming language. C was created by
Dennis Ritchie between 1969 -1973 and in 1979, Bjarne Stroustrup
created C with classes known as C++.
Both programming languages are still popular in programming
microcontrollers. In programming, we use a combination of letters,
words, and symbols, which are known as Tokens. All written codes will
go through a compiler to convert it to machine language.
Transducers
A Transducer is a device that converts energy from one form to
another. These devices are often used for automation,
measurement, and control system.
Sensors - are transducers that receive signals or stimulus from an
environment or physical system. Converts stimulus into electrical
signal.
Actuators - are transducers that actuate or move something -
converting electrical signal into actions.
Types of Signal
Analog - It can take up any number of values
or readings (Ex. Temperature)
Digital - It is represented by 2 values: either High
or Low or On or Off
Programming Syntax
Syntax refers to a set of rules used to determine if a
certain group of words forms a valid sentence - which is
also true in computer programming.
Arduino follows the C/C++ language. These two
programming languages use the same syntax.
void setup{ }
Void setup is technically a function that you create at the
top of each program. Inside the curly brackets is the
code that you want to run one time as soon as the
program starts running. You set things like pinMode in this
section.
void loop { }
The void loop is a function that Arduino integrates as a part of its
structure. Every command that is inside the loop will run
continuously as long as the microcontroller is turned on.
; (semicolon)
Signifies an end on the command line. Since the compiler does
not read spaces in the program, it looks for semicolons to read
every end of the statements.
{ } curly braces
A group of code statements. When troubleshooting your
program, always check first the curly braces if all opening curly
braces have partner closing curly braces.
() parentheses
A group of arguments for a function, a method, or a code
statement. Since programming languages follow PEMDAS
(Parenthesis, Equation, Multiplication, Division, Addition,
Subtraction), you can also use it to group math within equations.
Ex. random( (5-2), (480 - 220));With the example above, the result
will be: random(3,260);
Lesson-4-Arduino-Programming-dsBasics.pdf
// single line comment
When you type two forward slashes, the compiler ignores the
code from that point until the end of the line. Use comments to
clarify what the code does, to remember how the hardware is
connected, or to delete code from the software without
removing it entirely.
/* multi-line comment */
A multi-line comment needs to have /* as its opening and */ as
its closing. All characters between the symbols will be
considered as a comment. When you have a lot to type, use a
multi-line comment to make it easier to group the information
together.
Lesson-4-Arduino-Programming-dsBasics.pdf
Variables
A variable can store data from a sensor or results in a calculation.
These variables can then be called for later use in the program.
Lesson-4-Arduino-Programming-dsBasics.pdf
Using and Naming a Variable
Creating a Variable; To create a variable in C/C++. We must follow
these basic steps:
Declaration - before a variable is used, we need to declare it first to
inform the compiler about the data type and size. The syntax in
declaring a variable is simple:
Type the data type - for example, "int" for integer type of data.
Followed by the identifier or the name of the variable
In naming a variable, we must be mindful of the following:
Its name must start with a letter.
It may contain letters, numbers, and the underscore character.
It should not be a reserved word in the Arduino IDE.
It should not contain white spaces.
 Initialization of Variables - after declaring the variable, its value is set to default unless we assign
value to it. It is also possible to place value on the variable from the moment that it is declared.
 We created 1 variable to store pin number of the LED that we will use for the activity – led_1
Programming a circuit
Void setup is technically a function that you create at the top of
each program. Every code that is inside the curly braces will run
once as soon as the program starts running.
The pinMode command is usually placed here so that the
microcontroller reads the pin assignment first before running
other commands.
The setup() runs once when the Arduino is first powered on.
 The pinMode() function is used to configure a specific pin to behave either as an input or an output.
 Since the variable led1 is initialized with the value 2, we are configuring pin 2 as an Output.
 Note: We can directly put pin 2 to the setup without having a variable for it. It is also beneficial if we
are saving Arduino's memory.
 Void loop is another function that Arduino uses as part of its structure. The code inside the loop
function runs over and over if the Maker Board is turned on.
digitalWrite();
digitalWrite() is the command that allows you to send 5V or 0V
to an output pin. It takes two arguments: what pin to control,
and what value to set that pin, HIGH or LOW.
delay();
The delay() function lets you stop the Arduino from executing
anything for a period of time. delay() takes an argument that
determines the number of milliseconds before it executes the
next set of code. There are 1000 milliseconds in one second,
delay (250) will pause for a quarter of a second.
Lesson-4-Arduino-Programming-dsBasics.pdf

More Related Content

Similar to Lesson-4-Arduino-Programming-dsBasics.pdf (20)

Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10
stemplar
 
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
 
Arduino board program for Mobile robotss
Arduino board program for Mobile robotssArduino board program for Mobile robotss
Arduino board program for Mobile robotss
VSARAVANAKUMARHICETS
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
LITS IT Ltd,LASRC.SPACE,SAWDAGOR BD,FREELANCE BD,iREV,BD LAW ACADEMY,SMART AVI,HEA,HFSAC LTD.
 
Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'
tsyogesh46
 
[Apostila] programação arduíno brian w. evans
[Apostila] programação arduíno   brian w. evans[Apostila] programação arduíno   brian w. evans
[Apostila] programação arduíno brian w. evans
Web-Desegner
 
Arduino Section Programming - from Sparkfun
Arduino Section Programming - from SparkfunArduino Section Programming - from Sparkfun
Arduino Section Programming - from Sparkfun
JhaeZaSangcapGarrido
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduino
Makers of India
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5
Syed Mustafa
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
Ajay578679
 
Arduino
ArduinoArduino
Arduino
LetzkuLetz Castro
 
Hello Arduino.
Hello Arduino.Hello Arduino.
Hello Arduino.
mkontopo
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
Wingston
 
aurduino-200107075953.pdf
aurduino-200107075953.pdfaurduino-200107075953.pdf
aurduino-200107075953.pdf
HebaEng
 
Arduino: On-board components description, IDE and Programming
Arduino: On-board components description, IDE and Programming Arduino: On-board components description, IDE and Programming
Arduino: On-board components description, IDE and Programming
Pawan Dubey, PhD
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
baabtra.com - No. 1 supplier of quality freshers
 
Introduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingIntroduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and Programming
Emmanuel Obot
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
Siji Sunny
 
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 section programming slides
Arduino section programming slidesArduino section programming slides
Arduino section programming slides
vivek k
 
Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10
stemplar
 
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
 
Arduino board program for Mobile robotss
Arduino board program for Mobile robotssArduino board program for Mobile robotss
Arduino board program for Mobile robotss
VSARAVANAKUMARHICETS
 
Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'
tsyogesh46
 
[Apostila] programação arduíno brian w. evans
[Apostila] programação arduíno   brian w. evans[Apostila] programação arduíno   brian w. evans
[Apostila] programação arduíno brian w. evans
Web-Desegner
 
Arduino Section Programming - from Sparkfun
Arduino Section Programming - from SparkfunArduino Section Programming - from Sparkfun
Arduino Section Programming - from Sparkfun
JhaeZaSangcapGarrido
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduino
Makers of India
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5
Syed Mustafa
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
Ajay578679
 
Hello Arduino.
Hello Arduino.Hello Arduino.
Hello Arduino.
mkontopo
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
Wingston
 
aurduino-200107075953.pdf
aurduino-200107075953.pdfaurduino-200107075953.pdf
aurduino-200107075953.pdf
HebaEng
 
Arduino: On-board components description, IDE and Programming
Arduino: On-board components description, IDE and Programming Arduino: On-board components description, IDE and Programming
Arduino: On-board components description, IDE and Programming
Pawan Dubey, PhD
 
Introduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingIntroduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and Programming
Emmanuel Obot
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
Siji Sunny
 
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 section programming slides
Arduino section programming slidesArduino section programming slides
Arduino section programming slides
vivek k
 

More from unicaeli2020 (10)

gen chem.pdf gen chem.pdfgen chem.pdfgen chem.pdf
gen chem.pdf gen chem.pdfgen chem.pdfgen chem.pdfgen chem.pdf gen chem.pdfgen chem.pdfgen chem.pdf
gen chem.pdf gen chem.pdfgen chem.pdfgen chem.pdf
unicaeli2020
 
GENDER ROLEpptxd d d d d d d d d d d d d d d
GENDER ROLEpptxd d d d d d d d d d d d d  d dGENDER ROLEpptxd d d d d d d d d d d d d  d d
GENDER ROLEpptxd d d d d d d d d d d d d d d
unicaeli2020
 
Lesson-2-Earth-Subsystem.pptxnnn nn nn jn
Lesson-2-Earth-Subsystem.pptxnnn nn nn jnLesson-2-Earth-Subsystem.pptxnnn nn nn jn
Lesson-2-Earth-Subsystem.pptxnnn nn nn jn
unicaeli2020
 
Lesson-3-Advance-Spreadsheet (1).pdfmmm mmm
Lesson-3-Advance-Spreadsheet (1).pdfmmm mmmLesson-3-Advance-Spreadsheet (1).pdfmmm mmm
Lesson-3-Advance-Spreadsheet (1).pdfmmm mmm
unicaeli2020
 
Lesson-2-Cyber-Security.pdf"Chemistry: The Invisible Force Shaping Our World."
Lesson-2-Cyber-Security.pdf"Chemistry: The Invisible Force Shaping Our World."Lesson-2-Cyber-Security.pdf"Chemistry: The Invisible Force Shaping Our World."
Lesson-2-Cyber-Security.pdf"Chemistry: The Invisible Force Shaping Our World."
unicaeli2020
 
Biological-Macromolecules-Week-7 b b .ppt
Biological-Macromolecules-Week-7 b b .pptBiological-Macromolecules-Week-7 b b .ppt
Biological-Macromolecules-Week-7 b b .ppt
unicaeli2020
 
TEST ON ANALOGY.pptx dd dd dd d d d d d
TEST ON ANALOGY.pptx dd dd dd d d d d  dTEST ON ANALOGY.pptx dd dd dd d d d d  d
TEST ON ANALOGY.pptx dd dd dd d d d d d
unicaeli2020
 
Presentation1 (1).pptx englishy.........
Presentation1 (1).pptx englishy.........Presentation1 (1).pptx englishy.........
Presentation1 (1).pptx englishy.........
unicaeli2020
 
Noli-Me-Tangere-Kabanata-51-at-52.pptx
Noli-Me-Tangere-Kabanata-51-at-52.pptxNoli-Me-Tangere-Kabanata-51-at-52.pptx
Noli-Me-Tangere-Kabanata-51-at-52.pptx
unicaeli2020
 
Pollution and Road Safety Grade 10 Health 2nd Grading
Pollution and Road Safety Grade 10 Health 2nd GradingPollution and Road Safety Grade 10 Health 2nd Grading
Pollution and Road Safety Grade 10 Health 2nd Grading
unicaeli2020
 
gen chem.pdf gen chem.pdfgen chem.pdfgen chem.pdf
gen chem.pdf gen chem.pdfgen chem.pdfgen chem.pdfgen chem.pdf gen chem.pdfgen chem.pdfgen chem.pdf
gen chem.pdf gen chem.pdfgen chem.pdfgen chem.pdf
unicaeli2020
 
GENDER ROLEpptxd d d d d d d d d d d d d d d
GENDER ROLEpptxd d d d d d d d d d d d d  d dGENDER ROLEpptxd d d d d d d d d d d d d  d d
GENDER ROLEpptxd d d d d d d d d d d d d d d
unicaeli2020
 
Lesson-2-Earth-Subsystem.pptxnnn nn nn jn
Lesson-2-Earth-Subsystem.pptxnnn nn nn jnLesson-2-Earth-Subsystem.pptxnnn nn nn jn
Lesson-2-Earth-Subsystem.pptxnnn nn nn jn
unicaeli2020
 
Lesson-3-Advance-Spreadsheet (1).pdfmmm mmm
Lesson-3-Advance-Spreadsheet (1).pdfmmm mmmLesson-3-Advance-Spreadsheet (1).pdfmmm mmm
Lesson-3-Advance-Spreadsheet (1).pdfmmm mmm
unicaeli2020
 
Lesson-2-Cyber-Security.pdf"Chemistry: The Invisible Force Shaping Our World."
Lesson-2-Cyber-Security.pdf"Chemistry: The Invisible Force Shaping Our World."Lesson-2-Cyber-Security.pdf"Chemistry: The Invisible Force Shaping Our World."
Lesson-2-Cyber-Security.pdf"Chemistry: The Invisible Force Shaping Our World."
unicaeli2020
 
Biological-Macromolecules-Week-7 b b .ppt
Biological-Macromolecules-Week-7 b b .pptBiological-Macromolecules-Week-7 b b .ppt
Biological-Macromolecules-Week-7 b b .ppt
unicaeli2020
 
TEST ON ANALOGY.pptx dd dd dd d d d d d
TEST ON ANALOGY.pptx dd dd dd d d d d  dTEST ON ANALOGY.pptx dd dd dd d d d d  d
TEST ON ANALOGY.pptx dd dd dd d d d d d
unicaeli2020
 
Presentation1 (1).pptx englishy.........
Presentation1 (1).pptx englishy.........Presentation1 (1).pptx englishy.........
Presentation1 (1).pptx englishy.........
unicaeli2020
 
Noli-Me-Tangere-Kabanata-51-at-52.pptx
Noli-Me-Tangere-Kabanata-51-at-52.pptxNoli-Me-Tangere-Kabanata-51-at-52.pptx
Noli-Me-Tangere-Kabanata-51-at-52.pptx
unicaeli2020
 
Pollution and Road Safety Grade 10 Health 2nd Grading
Pollution and Road Safety Grade 10 Health 2nd GradingPollution and Road Safety Grade 10 Health 2nd Grading
Pollution and Road Safety Grade 10 Health 2nd Grading
unicaeli2020
 
Ad

Recently uploaded (20)

Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
Secure Access with Azure Active Directory
Secure Access with Azure Active DirectorySecure Access with Azure Active Directory
Secure Access with Azure Active Directory
VICTOR MAESTRE RAMIREZ
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data ResilienceFloods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Cisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdfCisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdf
superdpz
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
Secure Access with Azure Active Directory
Secure Access with Azure Active DirectorySecure Access with Azure Active Directory
Secure Access with Azure Active Directory
VICTOR MAESTRE RAMIREZ
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data ResilienceFloods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Cisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdfCisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdf
superdpz
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Ad

Lesson-4-Arduino-Programming-dsBasics.pdf

  • 2. WHAT IS A PROGRAM  is a written programming language which enables a computer to perform its function. Therefore, a program is a written instruction that process input, manipulate data, and output a result. Arduino uses C / C++ Programming language. C was created by Dennis Ritchie between 1969 -1973 and in 1979, Bjarne Stroustrup created C with classes known as C++. Both programming languages are still popular in programming microcontrollers. In programming, we use a combination of letters, words, and symbols, which are known as Tokens. All written codes will go through a compiler to convert it to machine language.
  • 3. Transducers A Transducer is a device that converts energy from one form to another. These devices are often used for automation, measurement, and control system. Sensors - are transducers that receive signals or stimulus from an environment or physical system. Converts stimulus into electrical signal. Actuators - are transducers that actuate or move something - converting electrical signal into actions.
  • 4. Types of Signal Analog - It can take up any number of values or readings (Ex. Temperature) Digital - It is represented by 2 values: either High or Low or On or Off
  • 5. Programming Syntax Syntax refers to a set of rules used to determine if a certain group of words forms a valid sentence - which is also true in computer programming. Arduino follows the C/C++ language. These two programming languages use the same syntax. void setup{ } Void setup is technically a function that you create at the top of each program. Inside the curly brackets is the code that you want to run one time as soon as the program starts running. You set things like pinMode in this section.
  • 6. void loop { } The void loop is a function that Arduino integrates as a part of its structure. Every command that is inside the loop will run continuously as long as the microcontroller is turned on.
  • 7. ; (semicolon) Signifies an end on the command line. Since the compiler does not read spaces in the program, it looks for semicolons to read every end of the statements.
  • 8. { } curly braces A group of code statements. When troubleshooting your program, always check first the curly braces if all opening curly braces have partner closing curly braces. () parentheses A group of arguments for a function, a method, or a code statement. Since programming languages follow PEMDAS (Parenthesis, Equation, Multiplication, Division, Addition, Subtraction), you can also use it to group math within equations. Ex. random( (5-2), (480 - 220));With the example above, the result will be: random(3,260);
  • 10. // single line comment When you type two forward slashes, the compiler ignores the code from that point until the end of the line. Use comments to clarify what the code does, to remember how the hardware is connected, or to delete code from the software without removing it entirely. /* multi-line comment */ A multi-line comment needs to have /* as its opening and */ as its closing. All characters between the symbols will be considered as a comment. When you have a lot to type, use a multi-line comment to make it easier to group the information together.
  • 12. Variables A variable can store data from a sensor or results in a calculation. These variables can then be called for later use in the program.
  • 14. Using and Naming a Variable Creating a Variable; To create a variable in C/C++. We must follow these basic steps: Declaration - before a variable is used, we need to declare it first to inform the compiler about the data type and size. The syntax in declaring a variable is simple: Type the data type - for example, "int" for integer type of data. Followed by the identifier or the name of the variable In naming a variable, we must be mindful of the following: Its name must start with a letter. It may contain letters, numbers, and the underscore character. It should not be a reserved word in the Arduino IDE. It should not contain white spaces.
  • 15.  Initialization of Variables - after declaring the variable, its value is set to default unless we assign value to it. It is also possible to place value on the variable from the moment that it is declared.  We created 1 variable to store pin number of the LED that we will use for the activity – led_1
  • 16. Programming a circuit Void setup is technically a function that you create at the top of each program. Every code that is inside the curly braces will run once as soon as the program starts running. The pinMode command is usually placed here so that the microcontroller reads the pin assignment first before running other commands. The setup() runs once when the Arduino is first powered on.
  • 17.  The pinMode() function is used to configure a specific pin to behave either as an input or an output.  Since the variable led1 is initialized with the value 2, we are configuring pin 2 as an Output.  Note: We can directly put pin 2 to the setup without having a variable for it. It is also beneficial if we are saving Arduino's memory.  Void loop is another function that Arduino uses as part of its structure. The code inside the loop function runs over and over if the Maker Board is turned on.
  • 18. digitalWrite(); digitalWrite() is the command that allows you to send 5V or 0V to an output pin. It takes two arguments: what pin to control, and what value to set that pin, HIGH or LOW.
  • 19. delay(); The delay() function lets you stop the Arduino from executing anything for a period of time. delay() takes an argument that determines the number of milliseconds before it executes the next set of code. There are 1000 milliseconds in one second, delay (250) will pause for a quarter of a second.