Documente Academic
Documente Profesional
Documente Cultură
Shubham Panchal
Copyright © TELCOMA. All Rights Reserved
Module 3
programming form beginners
to advance
2. Understanding variables
4. Analog read
5. Introduction to pwm
6. Fade a led
7. If conditional statement
8. For loop
9. Using array
Copyright
Copyright © @ Shubham
TELCOMA. All Rights panchal
Reserved
Arduino syntax
Key understanding
the syntax of arduino is same as the c language
Copyright
Copyright © @ Shubham
TELCOMA. panchal
All Rights Reserved
Syntax elements
● ; = this is used to terminate a line and should be placed after every line
● { } = these are the curly brackets, the code is written in it and each
bracket { should be closed with }
Copyright @
Copyright © Shubham
TELCOMA. panchal
All Rights Reserved
Understanding variables and keywords
● Variable = declared by many types, they are given in data types
● Classes = they are used in object oriented programming for multiple functions calling in the
program it is the library of a specific thing that is to be used in the program
Copyright @ Shubham
Copyright © TELCOMA. panchal
All Rights Reserved
List of data types
These are the variable data types that can
Copyright
Copyright ©@ Shubham
TELCOMA. All Rightspanchal
Reserved
Analog read
About analog pin Numerical & Categorical
Copyright @ Shubham
Copyright © TELCOMA. panchal
All Rights Reserved
● Source code
● Visual when button pressed in serial monitor
Copyright
Copyright ©@ Shubham
TELCOMA. All Rightspanchal
Reserved
Difference between digital and analog
Both digital and analog are useful for particular operation and both can be input or output .
While digital only passes on and off state ,the analog five a fine value of the voltage difference for better result
difference
digital analog
• The digital signal can posses only two states as • The analog signal are 10 bit signals that gives
1 and 0 2^10 values that means 0 to 1023
• It can write up to 0 to 255
• They are used to control the state such led on or • They are used for a variety of signals such
off, motor stop or running control of speed or fading of led .it can also turn
on or off the led or motor
• All analog pin can be used as digital pins • All digital pins cannot be used as analog pins
,they are specified only can be used
• It uses function digitalRead or digitalWrite • It uses function analogRead or analogWrite
difference
Copyright
Copyright ©@ Shubham
TELCOMA. All Rightspanchal
Reserved
Fade a led
Copyright
Copyright ©@ Shubham
TELCOMA. All Rightspanchal
Reserved
If conditional If statement
5
The if statement can be can be put up inside Independent conditions
Another if statement or can be performed in else
multiple if independent statements in the same loop
Inter dependent conditions
And a common else statement
Else condition
Else statement
Copyright
Copyright ©@ Shubham
TELCOMA. All Rightspanchal
Reserved
For loop
Define
integer
increment
for loop is used for running a certain
statement until the condition is not fulfilled.
For loop
The for loop has main parts as
condition
The condition, the difference and the addition
on each step Statement
to run
The statement to run until the condition is to
be fulfilled For loop
close
The exit of loop when the condition is met bracket
Copyright
Copyright ©@ Shubham
TELCOMA. All Rightspanchal
Reserved
Next Module :
Physical computing basics