โ Arduino learning pathArduino ยท Module 4 of 10
Analog input and sensors
Read potentiometers and sensors.
๐ Key ideas
- analogRead(A0) returns 0โ1023 (10-bit ADC).
- Convert to voltage: value ร 5.0 / 1023.
- Potentiometers give variable voltage.
- Sensors: LDR (light), LM35/DHT11 (temperature), soil moisture.
- map() scales ranges: map(v, 0, 1023, 0, 100).
๐ก Real-life example: analogRead is a ruler measuring voltage in 1024 tiny steps.
analogReadReads 0โ1023 analog value
PotentiometerVariable resistor knob
LDRLight-dependent resistor
map()Re-scales a value between ranges