DigitLedDisplay: an example that runs
Yes. You can use the DigitLedDisplay library online in Mokxi with nothing to install, and the sketch runs in your browser against the simulated part (Eight-digit display, MAX7219). The example below, "Numbers on an eight-digit MAX7219 board", runs on the Arduino Uno R3.
Built in on Mokxi: #include <DigitLedDisplay.h> and it builds, with nothing to install. Free, and no account needed.
What DigitLedDisplay does
Numbers on the MAX7219 eight-digit board: setBright(), setDigitLimit(), printDigit() at any starting digit, raw write(), on(), off() and clear(). That is what DigitLedDisplay, by Ozhan Duran, covers. The sketch below uses it on the Arduino Uno: “Numbers on an eight-digit MAX7219 board”.
Ozhan Duran's DigitLedDisplay library, numbers on the MAX7219 eight-digit seven-segment board.
Each call is one sixteen-bit packet to one chip (no chains), shifted out on any three pins, as upstream does. As upstream, a minus sign shows as a 0, and nothing is lit until setDigitLimit() takes the chip out of shutdown.
The calls follow release 1.1.0 of the library, so a sketch written here builds on a real board too. The example is the one Mokxi's own tests build and run, so what is printed here is what runs.
| Library Manager name | DigitLedDisplay |
|---|---|
| Author | Ozhan Duran |
| Include | #include <DigitLedDisplay.h> |
| Boards | every board Mokxi compiles for |
| In the simulator | Simulated: it runs against the part the way it does on the bench. |
| Parts it drives | Eight-digit display, MAX7219 |
Install it
It builds on every board Mokxi compiles for.
In Mokxi it is built in: #include <DigitLedDisplay.h> and the sketch compiles, with no download, no zip and no Library Manager.
On a real board, install "DigitLedDisplay" by Ozhan Duran from the Arduino IDE’s Library Manager (Sketch, Include Library, Manage Libraries), or add DigitLedDisplay to lib_deps in PlatformIO. Mokxi follows the calls of release 1.1.0, so a sketch written here builds there too.
What to know in the simulator: One chip, no chains, as upstream. A minus sign shows as a 0, as upstream’s does.
- ESP32-C3
- Arduino Uno
- Arduino Nano
- Arduino Mega 2560
- Arduino Leonardo
- SparkFun Pro Micro
- Arduino Micro
- ESP32-C6
- WCH CH32V003
- ATtiny85
- Raspberry Pi Pico
- Raspberry Pi Pico W
- Seeed XIAO SAMD21
- STM32
- STM32 Nucleo-F411RE
- STM32 Blue Pill
- micro:bit V2
- Arduino Uno R4
- ESP32 DevKit
- ESP32-S3-DevKitC-1
- ESP8266 NodeMCU
- Arduino Pro Mini 3.3 V
- Seeed XIAO ESP32-C3
- ESP32-C3 SuperMini
- Seeed XIAO ESP32-C6
- ESP32-DevKitC V4
- LOLIN32 Lite
- Wemos D1 R32
- Cheap Yellow Display
- TTGO T-Display
- Seeed XIAO ESP32-S3
- Arduino Nano ESP32
- Arduino Nano RP2040 Connect
- Seeed XIAO RP2040
- Waveshare RP2040-Zero
- Arduino Uno R4 WiFi
The calls you will use
In the order a sketch meets them.
DigitLedDisplay ld
Makes ld, the DigitLedDisplay object the calls below are made on.
ld.setBright(10)
Sets the bright to the value you pass in. Arguments: brightness.
ld.setDigitLimit(8)
Sets the digit limit to the value you pass in. Arguments: limit.
ld.printDigit(12345678)
Prints the digit. Arguments: number, start digit.
ld.clear()
Clears it.
Example: Numbers on an eight-digit MAX7219 board
On the Arduino Uno R3. It runs in the browser exactly as printed.
#include "DigitLedDisplay.h"
/* Board pin to display pin: DIN, CS, CLK */
DigitLedDisplay ld = DigitLedDisplay(2, 3, 4);
void setup() {
Serial.begin(9600);
/* Set the brightness min:1, max:15 */
ld.setBright(10);
/* Set the digit count */
ld.setDigitLimit(8);
ld.printDigit(12345678);
delay(300);
ld.clear();
/* 1234 on the right, 56 starting from digit 4 */
ld.printDigit(1234);
ld.printDigit(56, 4);
Serial.println("printed 56 1234");
}
void loop() {}Wiring
- Arduino Uno R3 2 to Eight-digit display, MAX7219 DIN
- Arduino Uno R3 3 to Eight-digit display, MAX7219 CS
- Arduino Uno R3 4 to Eight-digit display, MAX7219 CLK
- Arduino Uno R3 5V to Eight-digit display, MAX7219 VCC
- Arduino Uno R3 GND to Eight-digit display, MAX7219 GND
Try DigitLedDisplay without installing anything
Open the example, change the sketch, and keep your version in a free account.