Link Search Menu Expand Document

Microcontroller Functions

Microcontrollers are special-purpose computers used for sensing and control. The Arduino software system provides access to these features via libraries that provide sets of functions (formally an API or Application Programming Interface). We describe some of these functions on this page.

Table of contents

  1. Analog Input
  2. Digital Input and Output
  3. Serial Monitor and Serial Plotter
  4. PWM
  5. I2C

Analog Input

Arduino boards like the Circuit Playground Express can convert an external DC voltage level into an internal (digital) value. This process is more generally called analog-to-digital conversion or ADC. On an Arduino board ADC is performed with the analogRead function.

Analog input can be used to read sensors that produce a change in voltage in response to a change in some external stimulus such as light levels, temperature and pressure. Analog input is also used to detect the position of a potentiometer, which allows a person to turn a knob to change the behavior of an Arduino sketch.

More information about analog input is available on this page.

Digital Input and Output

The “digital” in digital input and output refers to signals that can only take on two values. Depending on the circumstances, those two states can be labeled 1 and 0, or True and False, or HIGH and LOW.

Digital input occurs when the Arduino board detects a voltage level on one of its exposed digital pins (or channels). The digitalRead function returns a 1 or 0, depending on the voltage level on the pin. Digital input can be used to detect the state of an on/off switch or a button.

Digital output occurs when the Arduino board sets a voltage level on one of its exposed digital pins. The digitalWrite function sets the voltage level to HIGH or LOW. This can be used to turn on an LED, or two provide an input signal to other switching devices such as transistors.

More information about digital I/O is available on this page.

Serial Monitor and Serial Plotter

The Arduino IDE includes two utilities to display data sent from a sketch running on the Arduino board. The Serial Monitor and Serial Plotter are described on this page.

PWM

Pulse-width modulation (PWM) is a technique for providing variable power inputs to devices by varying the duration of digital on/off pulses. PWM is useful for controlling the brightness of LEDs and the speed of brushed DC motors.

Read more about PWM on this page.

I2C

I2C (also pronounced “I-squared-C”) is a serial communication protocol that is useful for connecting a microcontroller to sensors, displays and other peripheral devices.

A separate page describes how to use I2C on the Circuit Playground Express.