Inputs & Sensors
Buttons, knobs and sensors for distance, temperature and light.
- Reading a Pushbutton
Read a button with an external pull-down resistor and learn why an unconnected input floats.BeginnerPushbuttonResistorBreadboard - Pull-ups and Debouncing
Use INPUT_PULLUP for a one-wire button, then debounce it with millis() so each press counts once.IntermediatePushbutton - Potentiometers and ADC Readings
Turn a knob into a number from 0 to 1023 and convert it to volts.BeginnerPotentiometerSerial - Measuring Distance with an HC-SR04
Trigger an ultrasonic ping, time the echo with pulseIn(), and convert it to centimetres.IntermediateUltrasonic sensorSerial - Reading Temperature with a TMP36
Convert the TMP36's analog output to degrees Celsius, with averaging to steady the reading.BeginnerTMP36Serial - Sensing Light with a Photoresistor
Build a voltage divider with an LDR and turn on an LED when it gets dark.BeginnerLDRResistorLED