BackSection Summary: The Messy Real World

Activities 2.8 – 2.11. Use this to review, or to fill in a definition you missed.
1. Analog Input
Some inputs are not on or off. An analog pin reports a number across a range, and that number usually has to be scaled before it means anything to your program.
- Analog Input
- A pin that reports a range of values rather than just on or off.
- ADC
- Analog-to-digital converter — the circuit that turns a voltage into a number.
- Potentiometer
- A knob that divides a voltage; its middle leg reports the slider's position.
- Scaling
- Converting a value from one range into another, here 0–65535 down to 0–5.
2. Trusting a Sensor
Real readings wobble and drift. Averaging steadies them, the datasheet turns them into real units, and checking against something you already know tells you whether to believe the result.
- Calibration
- Comparing what a sensor reports against a known reference, and correcting the difference.
- Averaging
- Taking several readings and using their mean, so random wobble cancels out.
- Datasheet
- The manufacturer's document describing exactly how a component behaves — where the volts-to-degrees rule comes from.
- Offset
- A fixed amount added to a reading to correct a consistent error.
3. Thresholds and Alarms
A threshold turns a continuous reading into a decision. PWM drives the buzzer, and a latch makes an alarm keep sounding once it has been set off.
- Threshold
- A chosen value that turns a range of readings into a yes-or-no decision.
- Voltage Divider
- Two resistors in series; the voltage at the point between them depends on their ratio.
- PWM
- Pulse-width modulation — switching a pin on and off rapidly. Its rate sets pitch; its on-fraction sets power.
- Latch
- Remembering that something happened, so an alarm keeps sounding after the cause has passed.
4. Talking to a Display
The OLED is a device on a shared two-wire bus rather than a component on a pin. You draw into a buffer in memory, then push that buffer to the screen.
- I²C
- A two-wire bus that lets several devices share the same pair of pins, each with its own address.
- Qwiic
- SparkFun's solderless connector for I²C — one cable carrying power, ground, and the two data lines.
- Buffer
- A copy of the screen held in memory. Changes land there first and only appear when pushed to the display.
- Library
- Someone else's code, imported into yours, handling work you should not have to repeat.