Unit-1
Embedded Systems & Arduino Programming Basics
1. What is an Embedded System?
An embedded system is a microcontroller-based system that is designed to perform a specific
function or task. Unlike general-purpose computers (like laptops), embedded systems are tailored to
control specific hardware.
Examples:
• Microwave ovens
• Automatic washing machines
• Smart watches
• Medical devices
Features:
• Dedicated function
• Small size
• Low power consumption
• Real-time operation
2. Embedded C Basics: Operators for Arduino
Embedded C is widely used in programming microcontrollers like the Arduino. Understanding
operators is essential to perform tasks.
Types of Operators:
Type Operators Use Example
Arithmetic +, -, *, /, % a+b
Relational ==, !=, >, <, >=, <= a > b
Logical &&, `
Bitwise &, ` , ^, ~, <<, >>`
Assignment =, +=, -=, *=, /=, %= a += 5
Unary ++, --, -, + i++, --j
3. Familiarizing with the Arduino IDE
The Arduino IDE (Integrated Development Environment) is where you write and upload code (called
sketches) to your Arduino board.
Main Components:
• Editor Window: Write your code
• Verify Button: Checks for errors
• Upload Button: Sends code to the Arduino
• Serial Monitor: Communicates with the board
4. Sketch Designing for Arduino
An Arduino sketch is the program written in Arduino IDE using Embedded C.
Basic Structure:
void setup() {
// Runs once
void loop() {
// Runs again and again
• setup() is used to initialize settings.
• loop() is where the main logic goes.
5. Communication Interface Using Serial Port
The serial port is used to send and receive data between the computer and Arduino.
Key Functions:
• Serial.begin(9600); → Starts communication at 9600 bps
• Serial.print("Hello"); → Prints data
• Serial.println("World"); → Prints data with new line
• Serial.read(); → Reads incoming data
6. Understanding Code Operations
Boolean Operations
Used for decision-making in logic (e.g., if (a == b)).
Pointer Access Operations
Used to access and modify memory directly:
int a = 5;
int *ptr = &a; // pointer stores address of a
Bitwise Operations
Works at the bit-level:
a = a & b; // AND
a = a | b; // OR
a = a ^ b; // XOR
Compound Operations
Short forms of operations:
a += 3; // same as a = a + 3;
b <<= 1; // same as b = b << 1;
MCQs (Multiple Choice Questions)
1. What does an embedded system do?
a) General computing
b) Performs a specific function
c) Edits documents
d) Runs multiple OS
2. Which function runs repeatedly in an Arduino sketch?
a) main()
b) setup()
c) loop()
d) begin()
3. What is the use of Serial.begin(9600);?
a) Start a delay
b) Initialize serial communication
c) Begin analog input
d) End loop
4. Which operator checks if two values are equal?
a) =
b) ==
c) !=
d) &&
5. What does the & operator do in bitwise operations?
a) OR operation
b) AND operation
c) XOR operation
d) NOT operation