โ† Arduino learning path
Arduino ยท Module 4 of 10

Analog input and sensors

Read potentiometers and sensors.

๐Ÿ“– Key ideas

  1. analogRead(A0) returns 0โ€“1023 (10-bit ADC).
  2. Convert to voltage: value ร— 5.0 / 1023.
  3. Potentiometers give variable voltage.
  4. Sensors: LDR (light), LM35/DHT11 (temperature), soil moisture.
  5. 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