Exercise: Digital I/O with the Pico

Many sensors are intrinsically binary: on or off, active or inactive, high or low. These may be designed to have only two states, e.g. a mechanical SPST switch, or may be transforming an , ike a mechanicalinterpreting an underlying analog process by thresholding into

The world is an analog place; physical phenomena have continuity and exist over time. To represent a physical property computationally, the physical process information must be transduced into electrical form and then converted from an analog voltage into a digital number by an analog-to-digital converter, or ADC.

This is a wide and deep topic ranging from signal and information theory to robotics and epistemology, and we will only just begin to explore this idea. But to start, this exercise will use sensors which represent a physical condition as a varying voltage which we will process as a stream of integers.

Objectives

After this exercise, you should be able to:

  1. Sense a physical process using a digital sensor.

  2. Structure a program to continuously process sensor data.

  3. Apply program logic to detect events of interest.

Reference Guides

Please review the following reference guides as needed:

Reference Circuits

../../../_images/Pico-switch-example.png

A sample circuit for using a SPST mechanical switch. The pullup resistor provides a current to drive the digital input high unless the switch shunts that current to ground.