Course Content
IoT Engineering Course using ESP32 Wifi Robots

📘 Lesson P1 – What is Programming?


🎯 Lesson Objective

By the end of this lesson, students will:

  • Understand what programming actually means

  • Understand how microcontrollers execute instructions

  • Learn what a programming language is

  • Understand how code becomes machine instructions

  • Understand why programming is required for IoT

This lesson builds the mental model of how systems think.


1️⃣ What is Programming?

Programming is the process of giving instructions to a computer or microcontroller to perform specific tasks.

In simple words:

Programming is telling a machine what to do, step by step.

Machines cannot think.
They only follow instructions.

Those instructions are called programs.


2️⃣ Why Programming is Necessary in IoT

IoT devices do not work automatically.

They require logic.

Example:

If temperature > 30°C
→ Turn AC ON

If gas detected
→ Trigger alert

If water level < threshold
→ Turn pump ON

This decision-making process is programming.

Without programming:

Sensors only measure.
Controllers do nothing.

Programming gives intelligence to hardware.


3️⃣ How a Microcontroller Understands Instructions

Microcontrollers like ESP32 do not understand English.

They only understand:

Binary (0 and 1)

Example:

Turn LED ON
Internally becomes
101010101010 (machine code)

But writing binary is very difficult.

So we use high-level programming languages.


4️⃣ What is a Programming Language?

A programming language is a structured way of writing instructions that can later be translated into machine language.

Examples:

  • C

  • C++

  • Python

  • Java

In this course, we use:

Arduino-style C/C++

Because:

  • It is simple

  • It works directly with hardware

  • It is efficient for microcontrollers


5️⃣ How Code Becomes Machine Instructions

When you write code and click “Upload”:

This process happens:

Step 1 – You write C++ code
Step 2 – Compiler converts it into machine code
Step 3 – Machine code is uploaded into ESP32 memory
Step 4 – ESP32 executes instructions

This process is called:

Compilation

You are not sending text to ESP32.
You are sending machine instructions.


6️⃣ What Happens When ESP32 Runs a Program?

Once uploaded:

  • ESP32 starts executing instructions

  • It runs setup() once

  • It runs loop() repeatedly

It follows instructions exactly as written.

If you write wrong logic →
It executes wrong logic perfectly.

Machines do not guess.


7️⃣ Programming is Logic, Not Just Syntax

Many beginners think:

Programming = Writing code.

But actually:

Programming = Thinking logically.

Example:

Wrong thinking:
“Make AC smart”

Correct thinking:
If temperature > 30 → AC ON
Else → AC OFF

Programming is breaking a big problem into small logical steps.


8️⃣ Real-Life Analogy

Imagine you are instructing a robot:

  1. Walk forward 5 steps

  2. Turn right

  3. Pick object

  4. Return

If you skip one step, robot fails.

Programming works the same way.

You must give clear, step-by-step instructions.


9️⃣ Types of Programming in IoT

In IoT systems, programming involves:

🔹 Input Handling

Reading sensor values

🔹 Decision Making

if, else logic

🔹 Output Control

Turning relays, motors, LEDs ON/OFF

🔹 Communication

Sending data via WiFi

🔹 Automation

Manual vs automatic mode logic

Programming controls everything.


🔟 Programming vs Coding

Coding is writing syntax.

Programming is designing logic.

Example:

Coding:

 
if(temp > 30)
 

Programming:
Deciding when AC should turn ON and OFF.

Programming is thinking first, coding second.


1️⃣1️⃣ What Makes a Good Programmer?

A good programmer:

✔ Thinks logically
✔ Breaks problems into smaller steps
✔ Tests step by step
✔ Uses debugging tools
✔ Writes clean and structured code

Programming is a skill developed through practice.


1️⃣2️⃣ Common Beginner Mistakes

❌ Memorizing code without understanding
❌ Copy-pasting without thinking
❌ Not testing step by step
❌ Ignoring errors
❌ Fear of errors

Errors are part of learning.

Even professionals debug daily.


1️⃣3️⃣ Programming in This Course

In this course, you will learn programming by:

  • Writing simple examples

  • Controlling LEDs

  • Reading sensors

  • Using conditions

  • Creating functions

  • Building automation logic

We will not overload you with theory.

We will learn by building.


1️⃣4️⃣ Programming Mindset

Remember:

Hardware + Programming = Smart System

Without programming:
Hardware is useless.

Without hardware:
Programming is simulation.

Together:
They create IoT systems.


📌 Lesson Summary

In this lesson, we learned:

  • What programming is

  • Why programming is required

  • How microcontrollers understand instructions

  • What programming languages are

  • What compilation means

  • Difference between coding and programming

  • Programming mindset

You now understand what it means to instruct a machine.

Scroll to Top