🎛
Lecție 4 · clasă 13+
Inputs: buttons and sensors — the board starts to feel
📖 Lecție
──▶
🎯 Quiz — alege traducerea
──▶
✅ Lecție parcursă
Until now the board only "spoke" — now it "listens". Button: pinMode(2, INPUT_PULLUP) — built-in resistor, fewer wires; pressed = LOW. Sensors: photoresistor (light), DHT11/DHT22 (temperature+humidity, ~€3), HC-SR04 (ultrasonic distance), PIR (motion), DS18B20 (precise temperature). Analog sensors → analogRead gives 0–1023. The logic never changes: read sensor → decide (if) → switch something.
- ●INPUT_PULLUP — button with no external resistor
- ●A sensor starter kit (Elegoo/Freenove) ~€30–50 — enough for 20 projects
- ●The DHT11 is slow (1 reading/s) — don’t poll it more often
🎛 The HC-SR04 measures distance by echo like a bat: ping → wait for echo → distance = time × speed of sound / 2. Accurate to 3 mm — for €3.