Introduction / About this library

CTRL library

v2.3.0 / Arduino library / MIT license

CTRL gives buttons, rotary encoders, potentiometers, LEDs and multiplexers one consistent, beginner-friendly interface, with debouncing, smoothing, groups and interrupt-safe input built in.

Get started View on GitHub
button.ino
#include <CtrlBtn.h> CtrlBtn button(2, 15);   // A debounced button on pin 2. void setup() {  Serial.begin(9600);} void loop() {  button.process();  if (button.isPressed()) {    Serial.println("Button pressed");  }}

About this library

Every real-world control gets a feature-rich software counterpart: CtrlBtn, CtrlEnc, CtrlPot, CtrlLed, CtrlRGBLed, CtrlMux and CtrlGroup. You can instantiate them in several ways to suit your project, and extend them with whatever extra functionality you need.

A lot of time went into performance. In real-time applications such as DSP, the code needs to get out of the way as much as possible, and CTRL is built for exactly that.

CTRL was developed with the Arduino IDE in mind, and works just as well with PlatformIO in CLion or VS Code. It runs on Arduino AVR boards (Uno, Mega), ESP32, Raspberry Pi Pico (RP2040), Teensy and more.

It is free. Do with it whatever you like, and pay it forward to the next person.

Start here

1

Installation

Install CTRL from the Arduino Library Manager, or as a ZIP from the release page.

2

Using the library

Include the library and write your first sketch with a debounced button.

3

Hookup guides

Wire buttons, potentiometers, rotary encoders, LEDs and multiplexers on a breadboard.