LESSONEmbedded C · Part 1EP.19 · 20 s

What is Embedded C?

// WHAT YOU WILL LEARN

C that runs straight on a microcontroller, no operating system — Arduino code is C++ wrapped around the same chip.

// LESSON NOTES

Your Arduino code is NOT C… it's C++. 🤯

Embedded C = plain C that runs straight on a microcontroller. No Windows, no Linux, no operating system in between. Nothing sits between your code and the chip.

Arduino gives you easy functions. digitalWrite(13, HIGH) hides 4 steps: look up pin 13 → PORTB bit 5, check its PWM timer, pause interrupts, and only then set the bit.

In Embedded C you set that bit yourself:
DDRB |= (1 << DDB5); → pin D13 = output
PORTB |= (1 << PORTB5); → LED ON
while (1) { } → the chip never stops

avr-gcc turns each of those lines into ONE machine instruction. The whole program is just 138 bytes.

Try it: paste it into the Arduino IDE (a sketch with its own int main() works) or a free online Uno simulator. The L LED turns on.

TESTED CODE · ec01_what_is_embedded_c.c · avr-gcc
// EC L01 - Embedded C: plain C, straight on the chip (no OS)
#include <avr/io.h>

int main(void) {
    DDRB  |= (1 << DDB5);    // pin D13 = output
    PORTB |= (1 << PORTB5);  // LED ON
    while (1) { }            // chip never stops
}

Related lessons