Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jasonacox/TM1637TinyDisplay
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.5.2
Choose a base ref
...
head repository: jasonacox/TM1637TinyDisplay
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jun 5, 2022

  1. New CI Tag

    jasonacox committed Jun 5, 2022
    Copy the full SHA
    fca0405 View commit details
  2. Update CI name

    jasonacox committed Jun 5, 2022
    Copy the full SHA
    f977128 View commit details
  3. Add CI Build Test Tag

    jasonacox committed Jun 5, 2022
    Copy the full SHA
    3c30af5 View commit details
  4. Copy the full SHA
    66b0ef7 View commit details

Commits on Jul 31, 2022

  1. Copy the full SHA
    10c22c9 View commit details
  2. enable brightness direct write

    By simply moving the writing of the TM1637_I2C_COMM3 into the setBrightness, the command becomes instantaneous and allows the brightness to be varied or the display to be turned off or on without rewriting a message after the setBrightness.
    stef-ladefense committed Jul 31, 2022
    Copy the full SHA
    bef4608 View commit details

Commits on Aug 1, 2022

  1. Merge pull request #20 from stef-ladefense/master

    enable brightness direct write
    jasonacox authored Aug 1, 2022
    Copy the full SHA
    29ec8ac View commit details
  2. Add isflipDisplay()

    jasonacox committed Aug 1, 2022
    Copy the full SHA
    3bff13c View commit details
  3. Copy the full SHA
    9dadc26 View commit details
  4. Add buffered display

    jasonacox committed Aug 1, 2022
    Copy the full SHA
    eb473ff View commit details
  5. v1.6.0 prep #18 #19

    jasonacox committed Aug 1, 2022
    Copy the full SHA
    df28df2 View commit details
  6. Copy the full SHA
    8e3dae8 View commit details

Commits on Sep 17, 2022

  1. Copy the full SHA
    7acb779 View commit details
  2. Copy the full SHA
    3cc96e2 View commit details
  3. Copy the full SHA
    202c9c2 View commit details
  4. Copy the full SHA
    ade164e View commit details
  5. Copy the full SHA
    ad41dd2 View commit details

Commits on Sep 19, 2022

  1. Copy the full SHA
    828c0eb View commit details
  2. Copy the full SHA
    76d5e65 View commit details
  3. Merge pull request #24 from hackerceo/master

    Add non-blocking animation and string scrolling to 4-digit display
    jasonacox authored Sep 19, 2022
    Copy the full SHA
    8a18e18 View commit details
  4. v1.7.0 Prep

    jasonacox committed Sep 19, 2022
    Copy the full SHA
    2194661 View commit details

Commits on Oct 7, 2022

  1. Copy the full SHA
    5b524e1 View commit details
  2. Merge pull request #1 from jasonacox/master

    Update from master branch
    hackerceo authored Oct 7, 2022
    Copy the full SHA
    e38e84f View commit details
  3. Merge pull request #25 from hackerceo/master

    Fix function names for async animation/scroll in keywords.txt
    jasonacox authored Oct 7, 2022
    Copy the full SHA
    bf8e65f View commit details

Commits on Nov 4, 2022

  1. Copy the full SHA
    8720b95 View commit details
  2. Update release notes

    jasonacox committed Nov 4, 2022
    Copy the full SHA
    ba0f0c8 View commit details

Commits on Feb 19, 2023

  1. Updated library operation

    mgesteiro committed Feb 19, 2023
    Copy the full SHA
    5fed555 View commit details

Commits on Feb 20, 2023

  1. Add clear() call to begin()

    When begin() is called, display initialization will be performed, including setting the hardware pins, clearing the shadow memory and sending that to the TM1637 as the first payload. Valid assertion after begin() call = shadow memory and display are in sync.
    jasonacox authored Feb 20, 2023
    Copy the full SHA
    b51055f View commit details
  2. Add clear() call to begin()

    When begin() is called, display initialization will be performed, including setting the hardware pins, clearing the shadow memory and sending that to the TM1637 as the first payload. Valid assertion after begin() call = shadow memory and display are in sync.
    jasonacox authored Feb 20, 2023
    Copy the full SHA
    1c9e674 View commit details
  3. Merge pull request #29 from mgesteiro/constructor_update

    Updated library operation with new begin() method
    jasonacox authored Feb 20, 2023
    Copy the full SHA
    7052651 View commit details
  4. Copy the full SHA
    3af50e3 View commit details
  5. Copy the full SHA
    0632c9b View commit details

Commits on Mar 1, 2023

  1. Set default brightness

    mgesteiro committed Mar 1, 2023
    Copy the full SHA
    249f2e0 View commit details

Commits on Mar 2, 2023

  1. Merge pull request #30 from mgesteiro/brightness

    Set default brightness
    jasonacox authored Mar 2, 2023
    Copy the full SHA
    e8704b0 View commit details
  2. v1.8.1

    jasonacox committed Mar 2, 2023
    Copy the full SHA
    e97cf87 View commit details

Commits on Mar 4, 2023

  1. v1.8.1

    jasonacox committed Mar 4, 2023
    Copy the full SHA
    f32a6b5 View commit details

Commits on Mar 18, 2023

  1. Merge pull request #2 from jasonacox/master

    Updates my branch
    hackerceo authored Mar 18, 2023
    Copy the full SHA
    6fbf240 View commit details

Commits on Mar 26, 2023

  1. Cleanup code

    hackerceo committed Mar 26, 2023
    Copy the full SHA
    a9e77c6 View commit details

Commits on Apr 1, 2023

  1. Copy the full SHA
    6451d7f View commit details
  2. Copy the full SHA
    cc41d2e View commit details
  3. Merge pull request #31 from hackerceo/master

    Add non-blocking animation support to 6 digit displays
    jasonacox authored Apr 1, 2023
    Copy the full SHA
    da09826 View commit details

Commits on Apr 3, 2023

  1. Prep v1.9.0 #31

    jasonacox committed Apr 3, 2023
    Copy the full SHA
    2b58751 View commit details

Commits on Apr 15, 2023

  1. Copy the full SHA
    5a90895 View commit details

Commits on Apr 16, 2023

  1. Merge pull request #33 from KelevraSlevin7/patch-1

    Changed abs() to labs() in showNumber() function
    jasonacox authored Apr 16, 2023
    Copy the full SHA
    b039771 View commit details
  2. v1.9.1 #33 #32

    jasonacox committed Apr 16, 2023
    Copy the full SHA
    200a2ff View commit details
  3. labs(x) macro #32

    jasonacox committed Apr 16, 2023
    Copy the full SHA
    815eb23 View commit details
  4. Copy the full SHA
    a7faa90 View commit details

Commits on Jul 1, 2023

  1. Update image links to direct

    To help with syndication, the image links are updated to be full URLs.
    jasonacox authored Jul 1, 2023
    Copy the full SHA
    8926be7 View commit details
  2. Add version to library manifest #34

    PlatformIO may need "version" element to pull latest version, as shown in https://docs.platformio.org/en/latest/librarymanager/creating.html.
    jasonacox authored Jul 1, 2023
    Copy the full SHA
    f13913e View commit details

Commits on Apr 25, 2024

  1. Enhanced character set #39

    jasonacox committed Apr 25, 2024
    Copy the full SHA
    6f8a106 View commit details
2 changes: 2 additions & 0 deletions .github/workflows/buildtest.yml
Original file line number Diff line number Diff line change
@@ -27,3 +27,5 @@ jobs:
run: arduino-cli compile --library . --warnings all -b arduino:avr:uno "examples/TM1637-6Digit-Test/TM1637-6Digit-Test.ino"
- name: Build ATtiny85.ino Example Sketch
run: arduino-cli compile --library . --warnings all -b arduino:avr:uno "examples/ATtiny85/ATtiny85.ino"
- name: Build TM1637-NonBlockingAnimate.ino Example Sketch
run: arduino-cli compile --library . --warnings all -b arduino:avr:uno "examples/TM1637-NonBlockingAnimate/TM1637-NonBlockingAnimate.ino"
2 changes: 1 addition & 1 deletion .github/workflows/sketch.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Test Arduino Library
name: Compile Example Sketches
name: Build Test

# The workflow will run on every push and pull request to the repository
on:
116 changes: 70 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,62 @@
# TM1637 Tiny Display #
# TM1637 Tiny Display

[![arduino-library-badge](https://www.ardu-badge.com/badge/TM1637TinyDisplay.svg?)](https://www.ardu-badge.com/TM1637TinyDisplay)
[![Build Status](https://app.travis-ci.com/jasonacox/TM1637TinyDisplay.svg?branch=master)](https://app.travis-ci.com/jasonacox/TM1637TinyDisplay)
[![Build Status](https://github.com/jasonacox/TM1637TinyDisplay/actions/workflows/sketch.yml/badge.svg)](https://github.com/jasonacox/TM1637TinyDisplay/actions/workflows/sketch.yml)

Arduino Library for the TM1637 Based LED Display Module

## Description

This is an Arduino library for 4 and 6 digit 7-segment LED display modules based on the TM1637 chip.
Connect the TM1637 display CLK and DIO pins to your Arduino GPIO pins, include this library, initialize TM1637TinyDisplay and call easy to use functions like showNumber(), showString(), showLevel() and showAnimation(). Display will scroll text for larger strings. Functions support screen splitting for easy number + text formatting. Library also runs well on tiny controllers including the ATtiny85.
Connect the TM1637 display CLK and DIO pins to your Arduino GPIO pins, include this library, initialize TM1637TinyDisplay and call easy to use functions like `showNumber()`, `showString()`, `showLevel()` and `showAnimation()`. Display will scroll text for larger strings. Functions support screen splitting for easy number + text formatting. Library also runs well on tiny controllers including the ATtiny85.

## Hardware

## Hardware
![TM1637](examples/tm1637.png)
![TM1637](https://raw.githubusercontent.com/jasonacox/TM1637TinyDisplay/master/examples/tm1637.png)

* 4-Digit Display modules based on the TM1637 chip are available from [HiLetgo](https://www.amazon.com/gp/product/B01DKISMXK/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1), [DX](https://dx.com/p/0-36-led-4-digit-display-module-for-arduino-black-blue-works-with-official-arduino-boards-254978) and [SeeedStudio](https://www.digikey.com/products/en?keywords=tm1637).
* 6-Digit Display modules - see [here](https://github.com/jasonacox/TM1637TinyDisplay#tm1637-6-digit-display---tm1637tinydisplay6).

![TM1637](examples/tm1637back.png)
![TM1637](https://raw.githubusercontent.com/jasonacox/TM1637TinyDisplay/master/examples/tm1637back.png)

The display has four connectors:
* CLK - Clock - attach to any GPIO output
* DIO - Data - attach to any GPIO output

* CLK - Clock - attach to any GPIO output
* DIO - Data - attach to any GPIO output
* VCC - Power 5v
* GND - Ground

Power Note: Steady clean power is important for circuit stability. If you are seeing display artifacts during high frequency updates or animation sequences, you may be experiencing power fluctuations that are impacting signal timing and communication with the TM1637. This is especially true with standalone microprocessor applications that lack any power conditioning (e.g. ATtiny85). A polarized 100uF electrolytic capacitor inserted across VCC and GND can help smooth out the spikes.
**Power Note:** Steady clean power is important for circuit stability. If you are seeing display artifacts during high frequency updates or animation sequences, you may be experiencing power fluctuations that are impacting signal timing and communication with the TM1637. This is especially true with standalone microprocessor applications that lack any power conditioning (e.g. ATtiny85). A polarized 100uF electrolytic capacitor inserted across VCC and GND can help smooth out the spikes.

Decimals and Colons: Some TM1637 displays come equipped with a middle colon LED (as shown above) as used in digital clocks but with no decimal points. Some displays come with decimal point LEDS for each digit. Some come with both but often the decimal point LEDs are not connected. These extra LEDs are activated by setting the upper bit (0x80) for the digit next to the dot. This library will handle setting that for you via the showNumber() function when you specify floating point numbers or via the showNumberDec() function where you can set the decimal point manually.
**Decimals and Colons:** Some TM1637 displays come equipped with a middle colon LED (like above) as used in digital clocks but with no decimal points. Some displays come with decimal point LEDS for each digit. Some come with both but often the decimal point LEDs are not connected. These extra LEDs are activated by setting the upper eighth bit (0x80) for the digit to the left of the dot. This library will handle setting that for you via the `showNumber()` function when you specify floating point numbers, or you can do it manually via the `showNumberDec()` function where you can set the decimal points/colon yourself.

## Installation
This library is available via the Arduino IDE. Install this library via `Tools`, `Manage Libraries`, search for "TM1637TinyDisplay" and click `Install`.

Alternatively, you can install this manually by cloning this repo into your Arduino library folder (e.g. `~/Documents/Arduino/libraries`).

## Usage
The library provides a single class named TM1637TinyDisplay with the following functions:
This library is available via the Arduino IDE. Install this library via `Tools`, `Manage Libraries`, search for "TM1637TinyDisplay" and click `Install`.

* `showNumber` - Display an integer and floating point numbers (positive or negative)
* `showNumberDec` - Display a number with ability to manually set decimal points or colon
* `showNumberHex` - Display a number in hexadecimal format and set decimal point or colon
* `showString` - Display a ASCII string of text with optional scrolling for long strings
* `showLevel` - Use display LEDs to simulate a level indicator (vertical or horizontal)
* `showAnimation` - Display a sequence of frames to render an animation
* `setSegments` - Directly set the value of the LED segments in each digit
* `setBrightness` - Sets the brightness of the display
* `setScrolldelay` - Sets the speed for text scrolling
* `flipDisplay` - Sets/flips the orientation of the display
Alternatively, you can install this manually by cloning this repo into your Arduino library folder (e.g. `~/Documents/Arduino/libraries`).

PROGMEM functions: Large string or animation data can be left in Flash instead of being loaded in to SRAM to save memory.
## Example Code

* `showAnimation_P` - Display a sequence of frames to render an animation (in PROGMEM)
* `showString_P` - Display a ASCII string of text with optional scrolling for long strings (in PROGMEM)
<p align="center">
<a href="examples/4-digit-display-basic.fzz"><img src="examples/4-digit-display-basic_bb.svg" width="40%" /></a><br />
Basic connection schematic done with <a href="https://fritzing.org">Fritzing</a>
</p>

## Example Code
```cpp
#include <Arduino.h>
#include <TM1637TinyDisplay.h>

// Define Digital Pins
#define CLK 1
#define DIO 2
#define CLK 2
#define DIO 3

// Initialize TM1637TinyDisplay
// Instantiate TM1637TinyDisplay Class
TM1637TinyDisplay display(CLK, DIO);

void setup() {
display.setBrightness(0x0f);
// Initialize Display
display.begin();
}

void loop() {
@@ -102,12 +95,11 @@ void loop() {
}
```
Refer to [TM1637TinyDisplay.h](TM1637TinyDisplay.h) for information on available functions. See also [Examples](examples) for more demonstration.
## Animation and Animator Tool
The showAnimation() function projects a sequence of frames (patterns) onto the display. This works by defining the animation sequence through a multi-dimensional array of patterns.
You can use the included javascript based interactive [7-Segment LED Animator Tool](https://jasonacox.github.io/TM1637TinyDisplay/examples/7-segment-animator.html) to help build your animation. The source code is in the [Examples](examples) folder. This tool will let you set up the LED sequences you want, save each frame and copy the final code (a static array) directly into your sketch to use for the `showAnimation(data, frames, timing)` function. Here is an example:
The `showAnimation()` function projects a sequence of frames (patterns) onto the display. This works by defining the animation sequence through a multi-dimensional array of patterns.
You can use the included javascript based interactive [7-Segment LED Animator Tool](https://jasonacox.github.io/TM1637TinyDisplay/examples/7-segment-animator.html) to help build your animation. The source code is in the [Examples](examples) folder. This tool will let you set up the LED sequences you want, save each frame and copy the final code (a static array) directly into your sketch to use for the `showAnimation(data, frames, timing)` function. Here is an example:
```cpp
// Data from Animator Tool
@@ -132,13 +124,13 @@ const uint8_t ANIMATION[12][4] = {
```
## TM1637 6-Digit Display - TM1637TinyDisplay6

![TM1637-6](examples/tm1637-6.png)
![TM1637-6](https://raw.githubusercontent.com/jasonacox/TM1637TinyDisplay/master/examples/tm1637-6.png)

6-Digit Display modules based on the TM1637 chip are available from [Amazon](https://smile.amazon.com/diymore-Display-Digital-Decimal-Segments/dp/B08G4BYR2B/ref=sr_1_2?crid=2ZNMBUFWRVDIL&dchild=1&keywords=tm1637%2B6%2Bdigit&qid=1617163070&sprefix=tm1637%2B%2Caps%2C218&sr=8-2&th=1) and [AliExpress](https://www.aliexpress.com/item/1005002060120661.html?spm=a2g0s.9042311.0.0.47454c4dYpnXsR).

![TM1637-6-Back](examples/tm1637-6-back.png)
![TM1637-6-Back](https://raw.githubusercontent.com/jasonacox/TM1637TinyDisplay/master/examples/tm1637-6-back.png)

This library now supports the 6-digit display as well as the 4-digit display. The 6-digit display requires additional handling. Specifically, the display digits are not sequential (requires a map) and the 7-segment LED data must be uploaded in reverse order.
This library now supports the 6-digit display as well as the 4-digit display. The 6-digit display requires additional handling. Specifically, the display digits are not sequential (requires a map) and the 7-segment LED data must be uploaded in reverse order.

TM1637TinyDisplay6 handles this for you but you must initialize the display using the TM1637TinyDisplay6 class:

@@ -148,15 +140,14 @@ TM1637TinyDisplay6 handles this for you but you must initialize the display usin
#include <TM1637TinyDisplay6.h> // Include 6-Digit Display Class Header

// Define Digital Pins
#define CLK 1
#define DIO 2
#define CLK 2
#define DIO 3

TM1637TinyDisplay6 display(CLK, DIO); // 6-Digit Display Class

void setup()
{
display.setBrightness(BRIGHT_HIGH);
display.clear();
display.begin();
display.showString("digits");
delay(1000);
display.showNumber(123456);
@@ -166,14 +157,47 @@ void setup()
}
```
## Functions
The library provides a single class named TM1637TinyDisplay with the following functions:
* `begin()` - Initialize display memory and hardware (call in `setup()`)
* `clear()` - Display an integer and floating point numbers (positive or negative)
* `showNumber(..)` - Display a number
* `showNumberDec(..)` - Display a number with ability to manually set decimal points or colon
* `showNumberHex(..)` - Display a number in hexadecimal format and set decimal point or colon
* `showString(..)` - Display a ASCII string of text with optional scrolling for long strings
* `startStringScroll(..)` - Begins a non-blocking scrolling of a string message
* `showLevel(..)` - Use display LEDs to simulate a level indicator (vertical or horizontal)
* `showAnimation(..)` - Display a sequence of frames to render an animation
* `startAnimation(..)` - Begins a non-blocking animation of a sequence of frames
* `Animate()` - Worker routine to be called regularly which handles animations and scrolling in a non-blocking manner
* `stopAnimation(..)` - Stops non-blocking animation
* `setSegments(..)` - Directly set the value of the LED segments in each digit
* `setBrightness(..)` - Sets the brightness of the display
* `setScrolldelay(..)` - Sets the speed for text scrolling
* `flipDisplay(..)` - Sets/flips the orientation of the display
* `isflipDisplay()` - Returns orientation of the display (True = flip)
* `readBuffer(..)` - Returns current display segment values
PROGMEM functions: Large string or animation data can be left in Flash instead of being loaded in to SRAM to save memory.
* `showAnimation_P(..)` - Display a sequence of frames to render an animation (in PROGMEM)
* `showString_P(..)` - Display a ASCII string of text with optional scrolling for long strings (in PROGMEM)
* `startAnimation_P(..)` - Begins a non-blocking animation of a sequence of frames stored in PROGMEM
* `startStringScroll_P(..)` - Begins a non-blocking scrolling of a string message stored in PROGMEM
Refer to [TM1637TinyDisplay.h](TM1637TinyDisplay.h) for information on available functions. See also [Examples](examples) for more demonstration.
## Arduino Library
* Library: https://www.arduinolibraries.info/libraries/tm1637-tiny-display
* Scan Logs: http://downloads.arduino.cc/libraries/logs/github.com/jasonacox/TM1637TinyDisplay/
## References and Credit
* This library is based on the great work by Avishay Orpaz - https://github.com/avishorp/TM1637
* SevenSegmentTM1637 Arduino Library by Bram Harmsen - https://github.com/bremme/arduino-tm1637
* Arduino - https://playground.arduino.cc/Main/TM1637/
* MCI Electronics Datasheet for TM1637 - https://www.mcielectronics.cl/website_MCI/static/documents/Datasheet_TM1637.pdf
* [Titan Micro Electronics](http://www.titanmec.com) Datasheet for TM1637 - [View docs/TM1637.pdf](docs/TM1637.pdf)
* TM16xx - Library for entire TM16xx chip family include maxint-rd's own [display-modules](https://github.com/maxint-rd/arduino-modules#display-modules) - https://github.com/maxint-rd/TM16xx
Loading