The document describes the components and programming of Arduino boards. It discusses the major hardware components of Arduino boards including the microcontroller, analog and digital pins, power supply, and USB interface. It then explains the Arduino IDE software for writing, compiling and uploading code to Arduino boards. Finally, it covers basic Arduino programming concepts such as setup and loop functions, if/else statements, and functions for digital input/output, analog input, and PWM output.
Arduino Workshop Day 1 Slides
Basics of Arduino - Introduction, Basics of Circuits, Signals & Electronics, LED Interfacing, Switch, Buzzer, LCD & Bluetooth Communication.
Arduino Uno is a microcontroller board based on 8-bit ATmega328P microcontroller. Along with ATmega328P, it consists other components such as crystal oscillator, serial communication, voltage regulator, etc. to support the microcontroller. Arduino Uno has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button.
Arduino Workshop Day 2 - Advance Arduino & DIYVishnu
Arduino Workshop Day 2 - IR, Ultrasonic & Temperature - Humidity Sensor Interfacing & Do It Yourself - Line Follower, Light Follower & Obstacle Avoider.
An introduction to the Arduino microcontroller for the Washington, DC Kids & Technology Meetup. Processing software, Arduino hardware were discussed. Several Arduino projects were demonstrated. Resources are posted here:
https://www.evernote.com/shard/s89/sh/6fd6ce79-c0b2-495e-b6f8-a4c4335cd284/9b1d07121e9f4b89106bcfcba6463bdf
Arduino Workshop Day 1 Slides
Basics of Arduino - Introduction, Basics of Circuits, Signals & Electronics, LED Interfacing, Switch, Buzzer, LCD & Bluetooth Communication.
Arduino Uno is a microcontroller board based on 8-bit ATmega328P microcontroller. Along with ATmega328P, it consists other components such as crystal oscillator, serial communication, voltage regulator, etc. to support the microcontroller. Arduino Uno has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button.
Arduino Workshop Day 2 - Advance Arduino & DIYVishnu
Arduino Workshop Day 2 - IR, Ultrasonic & Temperature - Humidity Sensor Interfacing & Do It Yourself - Line Follower, Light Follower & Obstacle Avoider.
An introduction to the Arduino microcontroller for the Washington, DC Kids & Technology Meetup. Processing software, Arduino hardware were discussed. Several Arduino projects were demonstrated. Resources are posted here:
https://www.evernote.com/shard/s89/sh/6fd6ce79-c0b2-495e-b6f8-a4c4335cd284/9b1d07121e9f4b89106bcfcba6463bdf
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauriGaurav Pandey
Arduino for beginners- Introduction to Arduino presentation
Learn Arduino basics in easy steps. Arduino for beginners course series.Arduino is an open-source platform used for building electronics projects. All Arduino boards have a microcontroller.
A microcontroller is basically a really small computer.
Introduction to Arduino Hardware and ProgrammingEmmanuel Obot
Introduction to Arduino Hardware and Programming:
Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects.
Teachers and students use it to build low cost scientific instruments, to prove chemistry and physics principles, or to get started with programming and robotics. Designers and architects build interactive prototypes, musicians and artists use it for installations and to experiment with new musical instruments. Makers, of course, use it to build many of the projects exhibited at the Maker Faire. Arduino is a key tool to learn new things. Anyone - children, hobbyists, artists, programmers can use it to build an interactive device.
Arduino first and foremost is an open-source computer hardware and software company. The Arduino Communityrefers to the project and user community that designs and utilizes microcontroller-based development boards. These development boards are known as Arduino Modules, which are open-source prototyping platforms.
The presentation is about the introduction of Arduino UNO, its description and usage. It also contains the pin configuration of Arduino along with its programming structure to implement a single blinking LED light.
An Arduino is an open-source microcontroller development board. In plain English, you can use the Arduino to read sensors and control things like motors and lights. This allows you to upload programs to this board which can then interact with things in the real world.
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauriGaurav Pandey
Arduino for beginners- Introduction to Arduino presentation
Learn Arduino basics in easy steps. Arduino for beginners course series.Arduino is an open-source platform used for building electronics projects. All Arduino boards have a microcontroller.
A microcontroller is basically a really small computer.
Introduction to Arduino Hardware and ProgrammingEmmanuel Obot
Introduction to Arduino Hardware and Programming:
Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects.
Teachers and students use it to build low cost scientific instruments, to prove chemistry and physics principles, or to get started with programming and robotics. Designers and architects build interactive prototypes, musicians and artists use it for installations and to experiment with new musical instruments. Makers, of course, use it to build many of the projects exhibited at the Maker Faire. Arduino is a key tool to learn new things. Anyone - children, hobbyists, artists, programmers can use it to build an interactive device.
Arduino first and foremost is an open-source computer hardware and software company. The Arduino Communityrefers to the project and user community that designs and utilizes microcontroller-based development boards. These development boards are known as Arduino Modules, which are open-source prototyping platforms.
The presentation is about the introduction of Arduino UNO, its description and usage. It also contains the pin configuration of Arduino along with its programming structure to implement a single blinking LED light.
An Arduino is an open-source microcontroller development board. In plain English, you can use the Arduino to read sensors and control things like motors and lights. This allows you to upload programs to this board which can then interact with things in the real world.
An Arduino is an open-source microcontroller development board. In plain English, you can use the Arduino to read sensors and control things like motors and lights. This allows you to upload programs to this board which can then interact with things in the real world.
presented by https://www.thingerbits.com, and https://www.arduino.lk
This course is a brief introduction about the Arduino platform. It is aggregating in one document most of the information available on the Arduino website.
The Arduino family of boards use processors developed by the Atmel Corporation of San Jose, California. Most of the Arduino designs utilize the 8-bit AVR series of microcontrollers, with the Due being the primary exception with its ARM Cortex-M3 32-bit processor.
By the end of this presentation you will be able to tell :
1. What is Arduino ?
2. Languages Supporting Arduino
3.Difference between microprocessor and microcontroller ?
4. Various different Arduino Boards
5. Arduino UNO R3 DataSheet
6. Parts and Functions of Arduino UNO R3 Board
7. Variables, functions and libraries used in Arduino board
8. Arduino Code: Blink Example
9. Applications of Arduino in real life
10. Simulators used for Arduino coding
WORKING PRINCIPLE OF ARDUINO AND USING IT AS A TOOL FOR STUDY AND RESEARCHijdpsjournal
This paper explores the working principle and applications of an Arduino board. This also explores on how
it can be used as a tool for study and research works. Arduino board can provide a quick tool in
development of VLSI test bench especially of sensors. Main advantages are fast processing and easy
interface. Today, with increasing number of people using open source software and hardware devices day
after day, technology is forming a new dimension by making complicated things look easier and interesting.
These open sources provide free or virtually low costs, highly reliable and affordable technology. This paper
provides a glimpse of type of Arduino boards, working principles, software implementation and their
applications.
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
Automobile Management System Project Report.pdfKamal Acharya
The proposed project is developed to manage the automobile in the automobile dealer company. The main module in this project is login, automobile management, customer management, sales, complaints and reports. The first module is the login. The automobile showroom owner should login to the project for usage. The username and password are verified and if it is correct, next form opens. If the username and password are not correct, it shows the error message.
When a customer search for a automobile, if the automobile is available, they will be taken to a page that shows the details of the automobile including automobile name, automobile ID, quantity, price etc. “Automobile Management System” is useful for maintaining automobiles, customers effectively and hence helps for establishing good relation between customer and automobile organization. It contains various customized modules for effectively maintaining automobiles and stock information accurately and safely.
When the automobile is sold to the customer, stock will be reduced automatically. When a new purchase is made, stock will be increased automatically. While selecting automobiles for sale, the proposed software will automatically check for total number of available stock of that particular item, if the total stock of that particular item is less than 5, software will notify the user to purchase the particular item.
Also when the user tries to sale items which are not in stock, the system will prompt the user that the stock is not enough. Customers of this system can search for a automobile; can purchase a automobile easily by selecting fast. On the other hand the stock of automobiles can be maintained perfectly by the automobile shop manager overcoming the drawbacks of existing system.
Event Management System Vb Net Project Report.pdfKamal Acharya
In present era, the scopes of information technology growing with a very fast .We do not see any are untouched from this industry. The scope of information technology has become wider includes: Business and industry. Household Business, Communication, Education, Entertainment, Science, Medicine, Engineering, Distance Learning, Weather Forecasting. Carrier Searching and so on.
My project named “Event Management System” is software that store and maintained all events coordinated in college. It also helpful to print related reports. My project will help to record the events coordinated by faculties with their Name, Event subject, date & details in an efficient & effective ways.
In my system we have to make a system by which a user can record all events coordinated by a particular faculty. In our proposed system some more featured are added which differs it from the existing system such as security.
Forklift Classes Overview by Intella PartsIntella Parts
Discover the different forklift classes and their specific applications. Learn how to choose the right forklift for your needs to ensure safety, efficiency, and compliance in your operations.
For more technical information, visit our website https://intellaparts.com
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
Vaccine management system project report documentation..pdfKamal Acharya
The Division of Vaccine and Immunization is facing increasing difficulty monitoring vaccines and other commodities distribution once they have been distributed from the national stores. With the introduction of new vaccines, more challenges have been anticipated with this additions posing serious threat to the already over strained vaccine supply chain system in Kenya.
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...Amil Baba Dawood bangali
Contact with Dawood Bhai Just call on +92322-6382012 and we'll help you. We'll solve all your problems within 12 to 24 hours and with 101% guarantee and with astrology systematic. If you want to take any personal or professional advice then also you can call us on +92322-6382012 , ONLINE LOVE PROBLEM & Other all types of Daily Life Problem's.Then CALL or WHATSAPP us on +92322-6382012 and Get all these problems solutions here by Amil Baba DAWOOD BANGALI
#vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore#blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #blackmagicforlove #blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #Amilbabainuk #amilbabainspain #amilbabaindubai #Amilbabainnorway #amilbabainkrachi #amilbabainlahore #amilbabaingujranwalan #amilbabainislamabad
Quality defects in TMT Bars, Possible causes and Potential Solutions.PrashantGoswami42
Maintaining high-quality standards in the production of TMT bars is crucial for ensuring structural integrity in construction. Addressing common defects through careful monitoring, standardized processes, and advanced technology can significantly improve the quality of TMT bars. Continuous training and adherence to quality control measures will also play a pivotal role in minimizing these defects.
Democratizing Fuzzing at Scale by Abhishek Aryaabh.arya
Presented at NUS: Fuzzing and Software Security Summer School 2024
This keynote talks about the democratization of fuzzing at scale, highlighting the collaboration between open source communities, academia, and industry to advance the field of fuzzing. It delves into the history of fuzzing, the development of scalable fuzzing platforms, and the empowerment of community-driven research. The talk will further discuss recent advancements leveraging AI/ML and offer insights into the future evolution of the fuzzing landscape.
Arduino: On-board components description, IDE and Programming
1. ONBOARD COMPONENTS DESCRIPTION, IDE
AND
PROGRAMMING SYNTAX
ARDUINO
By: Pawan Dubey
Research Mentor
Accendere Knowledge Management systems
2. WHAT IS ARDUINO ?
• Arduino is a microcontroller-based open source electronic prototyping board which
can be programmed with an easy-to-use Arduino IDE.
The major components of it are:
1. USB connector
2. Power port
3. Microcontroller
4. Analog input pins
5. Digital pins
6. Reset switch
7. Crystal oscillator
8. USB interface chip
9. TX RX LEDs
3. USB CONNECTOR
• This is a printer USB port used to load a program from the Arduino
IDE onto the Arduino board. The board can also be powered through
this port.
4. POWER PORT:
• The Arduino board can be powered through an AC-to-DC adapter or a battery. The
power source can be connected by plugging in a 2.1mm center-positive plug into the
power jack of the board.
• The Arduino UNO board operates at a voltage of 5 volts, but it can withstand a
maximum voltage of 20 volts.
5. MICROCONTROLLER:
• The most prominent black rectangular chip with 28 pins.
• The microcontroller used on the UNO board is Atmega328P by Atmel.
• Flash memory of 32KB: The program loaded from Arduino IDE
is stored here.
• RAM of 2KB: This is a runtime memory.
• CPU: It controls everything that goes on within the device.
It fetches the program instructions from flash memory, and runs them
with the help of RAM.
• Electrically Erasable Programmable Read Only Memory
(EEPROM) of 1KB. This is a type of nonvolatile memory, and it keeps the
data even after device restart and reset.
Atmega328P is pre-programmed with bootloader. This allows you to directly upload a new Arduino
program into the device, without using any external hardware programmer, making the Arduino
UNO board easy to use.
6. ANALOG INPUT PINS:
• The Arduino UNO board has 6 analog input pins, labeled “Analog 0 to 5.”
• These pins can read the signal from an analog sensor like a temperature sensor and convert it into a
digital value so that the system understands.
• These pins just measure voltage and not the current because they have very high internal resistance.
Hence, only a small amount of current flows through these pins.
• Although these pins are labeled analog and are analog input by default, these pins can also be used for
digital input or output.
7. DIGITAL PINS:
• You can find these pins labeled “Digital 0 to 13.” These
pins can be used as either input or output pins. When used
as output, these pins act as a power supply source for the
components connected to them. When used as input pins,
they read the signals from the component connected to
them.
• When digital pins are used as output pins, they supply 40
milliamps of current at 5 volts, which is more than
enough to light an LED.
• Some of the digital pins are labeled with tilde (~) symbol
next to the pin numbers (pin numbers 3, 5, 6, 9, 10, and
11). These pins act as normal digital pins but can also be
used for Pulse-Width Modulation (PWM), which
simulates analog output like fading an LED in and out.
8. RESET SWITCH:
• When this switch is clicked, it sends a logical
pulse to the reset pin of the Microcontroller,
and now runs the program again from the start.
• This can be very useful if your code doesn’t
repeat, but you want to test it multiple times.
9. CRYSTAL OSCILLATOR:
• This is a quartz crystal oscillator which ticks
16 million times a second.
• On each tick, the microcontroller performs
one operation, for example, addition,
subtraction, etc.
10. TX – RX LEDS:
• TX stands for transmit, and RX for receive.
• These are indicator LEDs which blink
whenever the UNO board is transmitting or
receiving data.
• Now that you have explored the Arduino
UNO board, you have started your journey
toward building your first IoT prototype.
• In the next article, we will discuss Arduino
programming and do a few experiments
with Arduino and LEDs.
12. ARDUINO INTEGRATED DEVELOPMENT
ENVIRONMENT (IDE)
1. Arduino programs are written in the Arduino Integrated Development
Environment (IDE).
2. Arduino IDE is a special software running on your system that allows
you to write sketches (synonym for program in Arduino language) for
different Arduino boards.
3. The Arduino programming language is based on a very simple hardware
programming language called processing, which is similar to the C
language.
4. After the sketch is written in the Arduino IDE, it should be uploaded on
the Arduino board for execution.
13. IDE ENVIRONMENT
1.An official software introduced by
Arduino.cc, that is mainly used for
1. Writing,
2. Compiling and
3. Uploading the code in the Arduino
Device.
2.Almost all Arduino modules are
compatible with this software that is an
open source and is readily available to
install and start compiling the code on the
go.
14. IDE ENVIRONMENT…CONT.
HOW TO DOWNLOAD THE SOFTWARE
1. You can download the Software from Arduino main website.
2. If you aim to download Windows app version, make sure you have
Windows 8.1 or Windows 10, as app version is not compatible with
Windows 7 or older version of this operating system.
15. IDE
ENVIRONMENT…CONT.
• File – You can open a new window for writing
the code or open an existing one.
• Edit – Used for copying and pasting the code
with further modification for font
• Sketch – For compiling and programming
• Tools – Mainly used for testing projects. The
Programmer section in this panel is used for
burning a bootloader to the new
microcontroller.
• Help – In case you are feeling skeptical about
software, complete help is available from
getting started to troubleshooting.
16. IDE
ENVIRONMENT…CONT.
• The check mark appearing in the circular
button is used to verify the code. Click this
once you have written your code.
• The arrow key will upload and transfer the
required code to the Arduino board.
• The dotted paper is used for creating a new
file.
• The upward arrow is reserved for opening
an existing Arduino project.
• The downward arrow is used to save the
current running code.
• The button appearing on the top right
corner is a Serial Monitor (Ctrl+Shift+M) –
A separate pop-up window that acts as an
independent terminal and plays a vital role
for sending and receiving the Serial Data.
17. IDE
ENVIRONMENT…CONT.
• The Serial Monitor will actually help to debug
the written Sketches where you can get a hold
of how your program is operating.
• Your Arduino Module should be connected to
your computer by USB cable in order to
activate the Serial Monitor.
• You need to select the baud rate of the Arduino
Board you are using right now.
• The baud rate may be different for different
Arduino which can be verified by
specifications.
18. IDE
ENVIRONMENT…CONT.
• The main screen below the Menu bar is known as a simple text editor used for writing the
required code.
• The bottom of the main screen is described as an Output Pane that mainly highlights the
compilation status of the running code: the memory used by the code, and errors occurred
in the program.
• You need to fix those errors before you intend to upload the hex file into your Arduino
Module.
19. IDE
ENVIRONMENT…CONT.
•Libraries are very useful for adding the extra functionality into the Arduino Module.
There is a list of libraries you can add by clicking the Sketch button in the menu bar and
going to Include Library..
• Most of the libraries are preinstalled and come with the Arduino software. However, you
can also download them from the external sources.
21. IDE
ENVIRONMENT…CONT.
• Selection of the communication port:
• COM1, COM2, COM4, COM5, COM7 or higher
are reserved for the serial and USB board.
• You can look for the USB serial device in the
ports section of the Windows Device Manager.
• After correct selection of both Board and Serial
Port, click the verify and then upload button
appearing in the upper left corner of the six button
section or you can go to the Sketch section and
press verify/compile and then upload.
22. • After correct selection of both Board and Serial Port, click the verify and then
upload button appearing in the upper left corner of the six button section or you can
go to the Sketch section and press verify/compile and then upload.
• The sketch is written in the text editor and is then saved with the file extension .ino.
• It is important to note that the recent Arduino Modules will reset automatically as
you compile and press the upload button the IDE software, however, older version
may require the physical reset on the board.
• Once you upload the code, TX and RX LEDs will blink on the board, indicating
the desired program is running successfully.
• The amazing thing about this software is that no prior arrangement or bulk of
mess is required to install this software, you will be writing your first program
within 2 minutes after the installation of the IDE environment.
23. IDE ENVIRONMENT…CONT.
• Boot Loader: As you go to the Tools section, you will find a bootloader at the end. It is very helpful
to burn the code directly into the controller, setting you free from buying the external burner to burn
the required code.
• When you buy the new Arduino Module, the bootloader is already installed inside the controller.
• However, if you intend to buy a controller and put in the Arduino module, you need to burn the
bootloader again inside the controller by going to the Tools section and selecting the burn bootloader.
25. THE STRUCTURE OF ARDUINO PROGRAM
• Preparation & Execution
• Each block has a set of statements
enclosed in curly braces:
void setup( )
{
statements-1;.
.
statement-n;
}
void loop ( )
{
statement-1;.
.
statement-n;
}
Here, setup ( ) is the preparation block and loop ( ) is an execution block.
26. THE SET-UP
• The setup function is the first to execute
when the program is executed, and this
function is called only once.
• The setup function is used to initialize the
pin modes and start serial communication.
• This function has to be included even if
there are no statements to execute.
• After the setup ( ) function is executed,
the execution block runs next.
void setup ( )
{
pinMode (pin-number, OUTPUT); // set the ‘pin-
number’ as output
pinMode (pin-number, INPUT); // set the ‘pin-number’
as output
}
27. EXECUTION BLOCK
• In the above example loop ( )
function is a part of execution block.
As the name suggests, the loop( )
function executes the set of
statements (enclosed in curly braces)
repeatedly.
Void loop ( )
{
digitalWrite (pin-number, HIGH); // turns ON the
component connected to ‘pin-number’
delay (1000); // wait for 1 sec
digitalWrite (pin-number, LOW); // turns OFF the
component connected to ‘pin-number’
delay (1000); //wait for 1sec
}
Note: Arduino always measures the time duration in millisecond.
Therefore, whenever you mention the delay, keep it in milli seconds.
28. EXAMPLE : LED BLINKING
• Steps in BUILDING A BREADBOARD
CONNECTION:
• Step-1: Connect the Arduino to the Windows
/ Mac / Linux system via a USB cable
• Step-2: Connect the 13th digital pin of
Arduino to the positive power rail of the
breadboard and GND to the negative
• Step-3: Connect the positive power rail to
the terminal strip via a 1K ohm resistor
• Step-4: Fix the LED to the ports below the
resistor connection in the terminal strip
• Step-5: Close the circuit by connecting the
cathode (the short chord) of the LED to the
negative power strip of the breadboard
29. PROGRAM: LED BLINKING
void setup ( )
{
pinMode (LED, OUTPUT); //Declaring pin 13 as output pin
}
void loop( ) // The loop function runs again and again
{
digitalWrite (LED, HIGH); //Turn ON the LED
delay(1000); //Wait for 1sec
digitalRead (LED, LOW); // Turn off the LED
delay(1000); // Wait for 1sec
}
31. ADVANCED PROGRAMMING CONCEPTS
• if statement
• if else statement
• for loop
• while loop
• do while loop
• pinMode
• digitalRead
• digitalWrite
• analogRead
• analogWrite
32. IF STATEMENT
• if statement
• The “if” statement is a conditional statement, it
checks if a certain condition is met. If yes, it
executes the set of statements enclosed in curly
braces. If the condition is false, then the set of
statements will skip the execution.
The syntax of the “if” statement is follows:
if(some variable ?? state)
{
statement-1;
statement-n;
}
• In the syntax format, ?? represents
comparison operator
• X==Y // Check if X is equal to Y
• X!=Y // X is not equal to Y
• X<Y // Check if X is less than Y
• X>Y // Check if X is greater than Y
• X<=Y // Check if X is less than or
equal to Y
• X >=Y // Check if X is greater than or
equal to Y
• Note: “=” is used to assign a value,
where as == is used for comparison.
Example
if (LED == HIGH)
{
digitalWrite(LED, LOW);
}
33. IF-ELSE STATEMENT
• if-else statement
• This statement makes an “either-or decision.
The if statements checks a condition. If it is
true, it executes a set of statements; if the
condition is not true, it executes other set of
statements.
• The syntax of the “if” statement is as :
if (some variable ?? state)
{
statement-1;
statement-n;
}
else
{
statement-1;
statement-n;
}
Example
if(LED==High)
{
digitalWrite(LED, LOW);
}
else
{
digitalWrite(LED,HIGH);
}
34. FOR – WHILE LOOP
• while loop
• The while loop executes a set
of statements until the
expression inside the
parentheses is false.
while (some variable ?? value)
{
Statement-1
Statement-n;
}
• for-loop
• If you want to repeatedly execute a
set of statements for a specific
number of times, then you can use a
for loop.
for(initialization; condition; expression)
{
Statement-1;
Statement-n;
}
while(i<=200)
{
digitalWrite (12, HIGH); //Turn on pin
number 12
delay(1000); //Wait for 1 sec
digitalWrite ( 12, LOW); //Turn pin number
12
delay (1000); //Wait for 1sec
i++;
}
for (int X=0; X<50; X++)
{
digitalWrite (12, HIGH); //Turn ON pin number 12
delay(1000);
digitalWrite ( 12, LOW); //Turn OFF pin number
12
delay (1000); //Wait for 1sec
}
35. DO-WHILE LOOP
Do-while loop
• If you want to execute a set of
statements once and repeatedly
execute the set if a certain condition
is true, the syntax of the “do-while”
loop is as follows:
do
{
statement-1;
statement-n;
} while (some variable ?? value);
pinMode
• This statement is used in the
preparation block of the Arduino
program, that is, in the void setup()
function.
• The pinMode statement is used to
configure a pin to behave in either the
INPUT mode or OUTPUT mode.
• The syntax of the “pinMode” statement
is as follows:
pinMode (pin-number, behaviour);
36. PIN READ-WRITE COMMAND
This statement reads the state of
the specified digital pin and the
result will be either HIGH or
LOW.
The syntax is as follows:
State=digitalread(pin-number);
digitalRead
digitalWrite statement is used to
either turn ON or OFF the device
connected to a specified digital
pin.
The syntax of the “digitalWrite”
statement is as follows:
digitalWrite(pin-number, status)
This statement reads the value from the
specified analog pin on the Arduino
board with 10-bit resolution. The result
will be an integer value in the range of
0 to 1023.
The syntax of the “analogRead
statement” is as follows:
value= analogRead (pin-number);
digitalWrite analogRead
analogWrite
This statement writes a pseudo-analog value to the specified pin. The value is
called pseudo-analog because it is generated by Pulse Width Modulation pins
(PMW) on the Arduino board. The value can be specified as a variable or
constant in the range of 0 to 255.
The syntax of “analogWrite” statement is as follows:
analogWrite(pin-number, value);