Digital input

Digital input is where a pin will detect the presence of a voltage level that is either “high” or “low”. When you read a digital pin in your program, these voltage levels are given to you as the boolean values of true for high and false for low.

Pins on edge of board

Logic levels

Whether a pin input level is high or low depends on where the microcontroller on the Adafruit Circuit Playground Express has set the voltage threshold for each. This is somewhere near the supply voltage for high (the voltage at the 3.3V pin) and near ground voltage for low (the voltage at GND pin, or 0V). Also, when a digital input is used for reading data, the input level is interpreted as a binary value of 1 for high and 0 for low. Multiple digital inputs are often combined in digital electronics to read larger values of binary numbers. Here’s the relationship between input voltage, logic value, and binary value:

Voltage Logic Binary
0 v false 0
3.3 v true 1

Experiments

There are several experiments to let you test out the concepts you learn in the digital input sections. You’ll need a few things to in order to perform some of the experiments.

Sections

[{
  "name": "Read a pin",
  "description": "Read a digital pin to get a logic value.",
  "url":"/learnsystem/pins-tutorial/digital-input/read-pin",
  "imageUrl":"https://cdn.makecode.com/blob/ce2c0150d9d33811b7c005ba25a1f02138143689/static/cp/learn/pins-tutorial/digital-input/read-pin-thumb.jpg"
}, {
  "name": "Input states",
  "description": "Understand what the default input levels are.",
  "url":"/learnsystem/pins-tutorial/digital-input/input-states",
  "imageUrl":"https://cdn.makecode.com/blob/b351a6ab05a5f727921603c0db7149f67d81d0e4/static/cp/learn/pins-tutorial/digital-input/input-states-thumb.jpg"
}, {
  "name": "Pin events",
  "description": "Programs are notified when something happens at a pin.",
  "url":"/learnsystem/pins-tutorial/digital-input/pin-events",
  "imageUrl":"https://cdn.makecode.com/blob/08a8572301276b2e73071f83b1e9cdf0859146dd/static/cp/learn/pins-tutorial/digital-input/pin-events-thumb.jpg"
}]