ARDUINO CLASS
Basic structure of an Arduino code
An Arduino program has two main functions
1. The void setup function
2. The void loop function
The void setup function runs once when the Arduino is powered or reset. It is
used to initialize settings like pinMode, Serial communication, etc.
The void loop function runs continuously until the Arduino is turned off. It
contains the main code that controls the board.
UNDERSTANDING THE BASIC SYNTAX
1. Comments ; They are used to explain code. They are ignored by the
compiler
//This is a single-line comment
/This is a multi-line comment*/
2. Semi-colon ; It marks the end of a statement .
3. Braces{} ; It groups multiple statements together especially in functions or
loops.
VARIABLES AND DATA TYPES
• Int
• Float
• Strings
• Boolean
BASIC ARDUINO FUNCTIONS
pinMode() ; It configures a pin as input or output eg. pinMode(5, OUTPUT)
digitalWrite() ; It sends high or low to a pin eg. digitalWrite(5, HIGH)
analogWrite() ; It sends analog values to a pin
delay() ; It pauses the program for a specified time in milliseconds