Uploaded by Moiz Ahmed

Day 2 - Introductionto C

advertisement
ARDUINO BASIC CONCEPT
Introduction to C/C++
Topics will be covered:
•
•
•
•
•
•
Serial Monitor
Variable Declaration
Data Types
Variable initialization
Types of variables
If else condition
Serial Monitor:
The serial monitor is the 'tether' between the computer and your Arduino - it lets you send and
receive text messages, handy for debugging and also controlling the Arduino from a keyboard!
Baud Rate:
Baud rate refers to the number of signal or symbol changes that occur per second. A symbol is
one of several voltage, frequency, or phase changes.
Variable Declaration:
Variable:
Anything which is liable to change or vary is called variable.
Naming Rules of variables:
1.
2.
3.
4.
5.
Variable name must begin with letter or underscore.
Variable are case sensitive
They can be constructed with digits, letters.
No special symbols are allowed other than underscore.
Prefer to use CAMEL writing style
Variable Declaration:
datatype variableName;
1
Prepared By: Moiz Ahmed
ARDUINO BASIC CONCEPT
Data Types:
Numeric Data Types:
•
•
•
•
•
•
•
•
•
Integer
Unsigned int
short
long
Unsigned long
Byte
Word
Float
Double
Text Data Types:
•
•
Char
String
Array Data Types:
•
Array
Variable Initialization:
Assigning value to variable is called variable initialization.
Types of Variable:
1. Global Variable
2. Local Variable
IF Else condition:
2
Function
Operation
Comparing
Not Equal
Greater than
Less than
Greater than equal to
Less than equal to
A == B
A != B
A>B
A<B
A <= B
A >= B
Prepared By: Moiz Ahmed
Download