Pisco Code encodes decimal, hexadecimal, or binary values as LED blink patterns using a single status LED. No serial port or display needed.
This is the Arduino-compatible distribution of the Pisco Code library. It is automatically generated from the main repository on each release.
⚠️ Requires C++17 — Works out of the box with ESP32, RP2040 (Pico), STM32, SAMD, ESP8266 and other boards whose toolchain defaults to C++17.
Other boards (e.g. Arduino AVR) can be used by enabling C++17 manually — see Enabling C++17 on older boards below.
- Open Arduino IDE
- Go to Sketch → Include Library → Manage Libraries…
- Search for Pisco-Code
- Click Install
- Download the latest release
.zipfrom Releases - In Arduino IDE: Sketch → Include Library → Add .ZIP Library…
#include <Pisco-Code.h>
bool ledOnboard(pisco_code::LedControlCode code)
{
switch (code)
{
case pisco_code::LedControlCode::ON:
digitalWrite(LED_BUILTIN, HIGH);
return true;
case pisco_code::LedControlCode::OFF:
digitalWrite(LED_BUILTIN, LOW);
return true;
default:
return false;
}
}
pisco_code::LedControllerSoftwarePwm controller(ledOnboard);
pisco_code::SignalEmitter emitter(controller);
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
emitter.showCode(
pisco_code::SignalCode{103},
pisco_code::Radix::DEC,
pisco_code::NumDigits{0});
}
void loop()
{
emitter.loop();
delay(1);
}Most embedded projects lack a convenient way to observe internal variables — serial ports, debuggers, or displays aren't always available. Pisco Code solves this by encoding values as LED blink patterns that anyone can read by eye.
A common approach is to blink an LED n times to represent the value n. For multi-digit numbers like 312, you blink 3 times, pause, 1 time, pause, 2 times:
This works — but breaks down for zeros (how do you blink 0 times?) and can be hard to follow.
Pisco Code adds a framing signal — a dim glow before each digit sequence begins. This makes every digit unambiguous, including zero:
Code 121:
Code 120 (with a zero digit):
Minimum digits (e.g. 002 for 0.02 V sensor reading):
Negative values (-12 — long blink prefix):
| Feature | Description |
|---|---|
| Bases | Decimal, binary, hexadecimal |
| Negative values | Long-blink prefix |
| Zero digits | Explicit gap representation |
| Min digits | Configurable (e.g., always show 3 digits for 0–5 V readings) |
| Controllers | Software PWM (GPIO toggle) and Hardware PWM (smooth dimming) |
| Memory | No dynamic allocation, no exceptions — ideal for constrained MCUs |
Pisco Code has been used in the Pisco de Luz project since 2020, reading battery voltage, solar panel output, temperature, and usage hours in off-grid solar lighting systems — all through a single LED.
For full documentation, architecture details, and cross-platform support (AVR, STM32, native), see the main repository.
Some boards (e.g. Arduino AVR — Uno, Mega, Nano) ship with a toolchain that defaults to C++11. You can switch to C++17 by creating a platform.local.txt file:
-
Find your board's
platform.txt. Common locations:OS Path Windows %LOCALAPPDATA%\Arduino15\packages\arduino\hardware\avr\<version>\macOS ~/Library/Arduino15/packages/arduino/hardware/avr/<version>/Linux ~/.arduino15/packages/arduino/hardware/avr/<version>/ -
In that same folder, create a new file called
platform.local.txtwith the following line:compiler.cpp.extra_flags=-std=gnu++17 -
Restart the Arduino IDE and recompile.
Note:
platform.local.txtoverrides settings without modifying the originalplatform.txt, so board-manager updates won't undo your change.
See the Changelog in the main repository.
MIT — see LICENSE.








