Microcontrollers and Your First Circuit
A microcontroller is a tiny computer on a chip that runs one program and talks to the physical world through its pins: reading sensors and controlling lights, motors and displays. Arduino boards and their programming environment make microcontrollers approachable. For connected (IoT) projects, ESP32 boards add Wi-Fi and Bluetooth and can be programmed with the same Arduino tools.
Common boards
| Board | Notes |
|---|---|
| Arduino Uno R3/R4 | classic beginner board; huge number of tutorials |
| Arduino Nano family | small, breadboard-friendly |
| ESP32 / ESP8266 | built-in Wi-Fi (ESP32 also Bluetooth); great for IoT |
| Raspberry Pi Pico | inexpensive, programmable in C/C++ or MicroPython |
Setup
- Install the Arduino IDE (version 2.x).
- Connect the board by USB; select the board and port in the IDE.
- For ESP32, add Espressif's board package via the Boards Manager.
Your first sketch
const int LED_PIN = 13; // many boards have an on-board LED here (LED_BUILTIN)
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH);
delay(500);
digitalWrite(LED_PIN, LOW);
delay(500);
}
setup() runs once; loop() runs forever. Click Upload.
An external LED on a breadboard
Connect: pin → current-limiting resistor (220–330 Ω) → LED long leg (anode); LED short leg (cathode) → GND. Without the resistor, the LED and the pin can be damaged.
Electrical safety basics
- Work with USB or low-voltage supplies while learning; never connect mains (AC) voltage to a breadboard.
- Check board voltage: many boards use 5 V logic, ESP32 and many sensors use 3.3 V and can be damaged by 5 V signals.
- Disconnect power before rewiring.
Exercise
Blink an external LED with a resistor, then make three LEDs blink in a traffic-light sequence.
Check yourself
- What is the difference between
setup()andloop()? - Why does an LED need a resistor?
- Why must you check whether a board uses 3.3 V or 5 V logic?
Ihr Fortschritt wird nur in diesem Browser gespeichert.
Zur Prüfung einreichen (10 Punkte)