Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erriez/erriezrobotdyn4digitdisplay
RobotDyn 4-digit 7-segment TM1637 display library for Arduino
https://github.com/erriez/erriezrobotdyn4digitdisplay
4-digit 7-segment arduino display documentation esp32 esp8266 getting library numeric robotdyn started tm1637 uno
Last synced: about 1 month ago
JSON representation
RobotDyn 4-digit 7-segment TM1637 display library for Arduino
- Host: GitHub
- URL: https://github.com/erriez/erriezrobotdyn4digitdisplay
- Owner: Erriez
- License: mit
- Created: 2018-07-31T15:24:56.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-28T18:19:22.000Z (over 4 years ago)
- Last Synced: 2024-11-24T22:32:45.894Z (2 months ago)
- Topics: 4-digit, 7-segment, arduino, display, documentation, esp32, esp8266, getting, library, numeric, robotdyn, started, tm1637, uno
- Language: C++
- Homepage: https://github.com/Erriez/ErriezArduinoLibrariesAndSketches
- Size: 786 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RobotDyn 4-digit LED display with TM1637 library for Arduino.
[![Build Status](https://travis-ci.org/Erriez/ErriezRobotDyn4DigitDisplay.svg?branch=master)](https://travis-ci.org/Erriez/ErriezRobotDyn4DigitDisplay)
This is a RobotDyn 4-digit 7-segment LED display library for Arduino. The PCB contains a two wire [TM1637 LED / button](https://github.com/Erriez/ErriezTM1637) controller.
![ErriezRobotDyn4DigitDisplay](https://raw.githubusercontent.com/Erriez/ErriezRobotDyn4DigitDisplay/master/extras/ErriezRobotDyn4DigitDisplay.png)
**Note**: This library uses the double-dot to display a time. The LED dots per segment are not wired and cannot be controlled.
## Library features
- Set brightness (0..7)
- Set digit (0..3)
- Control all individual segments per digit
- Control double dots (on/off)
- Display time (hours:minutes)
- Display decimal value (-999..9999) with optional padding
- Display hexadecimal value (0...0xFFFF) with optional padding## Hardware
**Connection display with Arduino**
| Display | Arduino UNO / Nano / Pro Mini / Leonardo / Mega2560 / ESP8266 / Lolin32 |
| :-----: | :----------------------------------------------------------- |
| GND | GND |
| VCC | 5V (or 3.3V) |
| CLK | Any DIGITAL pin |
| DIO | Any DIGITAL pin |Other MCU's may work, but are not tested.
## Examples
Arduino IDE | Examples | Erriez RobotDyn 4-digit display:
* [Erriez7SegementDisplayDemo](https://github.com/Erriez/ErriezRobotDyn4DigitDisplay/blob/master/examples/Erriez7SegementDisplayDemo/Erriez7SegementDisplayDemo.ino)
## Documentation
* [Online HTML](https://erriez.github.io/ErriezRobotDyn4DigitDisplay)
* [Download PDF](https://github.com/Erriez/ErriezRobotDyn4DigitDisplay/raw/master/ErriezRobotDyn4DigitDisplay.pdf)## Usage
**Initialization**
```c++
#include// Connect display pins to the Arduino DIGITAL pins
#if defined(ARDUINO_ARCH_AVR)
#define TM1637_CLK_PIN 2
#define TM1637_DIO_PIN 3
#elif defined(ARDUINO_ESP8266_WEMOS_D1MINI) || defined(ESP8266_WEMOS_D1MINI) || defined(ARDUINO_ESP8266_NODEMCU)
#define TM1637_CLK_PIN D2
#define TM1637_DIO_PIN D3
#elif defined(ARDUINO_LOLIN32)
#define TM1637_CLK_PIN 0
#define TM1637_DIO_PIN 4
#else
#error "May work, but not tested on this target"
#endif// Create display object
RobotDyn4DigitDisplay display(TM1637_CLK_PIN, TM1637_DIO_PIN);void setup()
{
// Initialize TM1637
display.begin();
}
```**Clear display**
```c++
// Clear display
display.clear(); // _ _ _ _
```**Set brightness**
```c++
// Set brightness
display.setBrightness(0); // Minimum
display.setBrightness(7); // Maximum
```**Display time**
```c++
// Display time
display.time(11, 59); // 1 1 : 5 9
```**Control time double dot**
```c++
display.doubleDots(true); // Turn double dot on
display.doubleDots(false); // Turn double dot off
```**Display decimal value**
```c++
// Display decimal values
display.dec(-999); // - 9 9 9
display.dec(-1); // _ _ - 1
display.dec(0); // _ _ _ 0
display.dec(1); // _ _ _ 1
display.dec(123); // _ 1 2 3
display.dec(9999); // 9 9 9 9
display.dec(10000); // - - - -// Display decimal values with padding
display.dec(1); // _ _ _ 1 (Default no padding)
display.dec(1, 2); // _ _ 0 1 (2 digits padding)
display.dec(1, 3); // _ 0 0 1 (3 digits padding)
display.dec(1, 4); // 0 0 0 1 (4 digits padding)display.dec(34, 3); // _ 0 3 4 (2 digits padding)
```**Display hexadecimal value**
```c++
// Display hexadecimal values
display.dec(0x0000); // 0 0 0 0
display.dec(0x1234); // 1 2 3 4
display.dec(0xABCD); // A B C D
display.dec(0xBEEF); // B E E F// Display hexadecimal values with padding
display.hex(0x0001); // _ _ _ 1 (Default no padding)
display.hex(0x0001, 2); // _ _ 0 1 (2 digits padding)
display.hex(0x0001, 3); // _ 0 0 1 (3 digits padding)
display.hex(0x0001, 4); // 0 0 0 1 (4 digits padding)display.hex(0x0034, 3); // _ 0 3 4 (2 digits padding)
```**Control individual digits**
```c++
// Display individual digits: 1 2 3 4
display.digit(0, 1);
display.digit(1, 2);
display.digit(2, 3);
display.digit(3, 4);
```**Special characters**
```c++
Control individual LED-segments (bit numbers):
- 0 -
| |
5 1
| |
- 6 -
| |
4 2
| |
- 3 - .7// Display error: E r r _
display.rawDigit(0, 0b01111001);
display.rawDigit(1, 0b01010000);
display.rawDigit(2, 0b01010000);
display.rawDigit(3, 0b00000000);// Display H character: _ _ _ H
display.rawDigit(3, 0b01110110);// Display negative temperature: - 1 ` C
display.rawDigit(0, SEGMENTS_MINUS);
display.digit(1, 1);
display.rawDigit(2, SEGMENTS_DEGREE);
display.rawDigit(3, SEGMENTS_CELSIUS);// Display rect
display.rawDigit(0, 0b00111001);
display.rawDigit(1, 0b00001001);
display.rawDigit(2, 0b00001001);
display.rawDigit(3, 0b00001111);
```## Library dependencies
* [Erriez TM1637](https://github.com/Erriez/ErriezTM1637) library
## Library installation
Please refer to the [Wiki](https://github.com/Erriez/ErriezArduinoLibrariesAndSketches/wiki) page.
## Other Arduino Libraries and Sketches from Erriez
* [Erriez Libraries and Sketches](https://github.com/Erriez/ErriezArduinoLibrariesAndSketches)