5.7. Signals#
A signal is an electrical pattern that represents data. Signals allow sensors to report information (like distance, light, or temperature) and controllers to make decisions and send instructions.
5.7.1. Analog Signals#
An analog signal can take any value in a range. Instead of only 0V or 3V, the signal might be 1.2V, 2.7V, or anywhere in between. Many real-world phenomena (light, sound, temperature, distance) are continuous, not just two states, which is more closely matched by an analog signal.
Examples
A temperature sensor might output 0.5V when it’s cold and 2.5V when it’s hot.
A microphone produces an analog signal that follows the shape of the sound wave.
5.7.2. Digital Signals#
A digital signal has only two possible states: ON (1) or OFF (0).
The ON is usually represented by a higher voltage (e.g., 3V) and OFF by 0V.
Digital signals are used for their reliability and relative ease of use for data transmission, compared to analog signals.
Examples
A robot’s line-following sensors output 1 if a line is detected and 0 if not.
The micro:bit’s LEDs are either lit (1) or dark (0).
5.7.3. Digital Buses#
Using basic digital signals we can create more complex communications protocols that can detect and correct transmission errors or support multiple sensors.
Note
We’ll learn more about digital signals and buses in a later section.