Giter VIP home page Giter VIP logo

tm1637tinydisplay's Introduction

TM1637 Tiny Display

arduino-library-badge Build Status

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.

Hardware

TM1637

  • 4-Digit Display modules based on the TM1637 chip are available from HiLetgo, DX and SeeedStudio.
  • 6-Digit Display modules - see here.

TM1637

The display has four connectors:

  • 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.

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).

Example Code


Basic connection schematic done with Fritzing

#include <Arduino.h>
#include <TM1637TinyDisplay.h>

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

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

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

void loop() {
  // Say Hello
  display.showString("HELLO");
  delay(500);

  // Clear Screen
  display.clear();

  // We can count!
  for (int x = -100; x <= 100; x++) {
    display.showNumber(x);
  }

  // Level indicator
  for (int x = 0; x <= 100; x = x + 10) {
    display.showLevel(x, false);
    delay(20);
  }
  for (int x = 100; x >= 0; x = x - 10) {
    display.showLevel(x, false);
    delay(20);
  }

  // Split screen for temperature
  display.showString("\xB0", 1, 3);        // Degree Mark, length=1, position=3 (right)
  for (int x = -90; x < 200; x++) {
    display.showNumber(x, false, 3, 0);    // Number, length=3, position=0 (left)
    delay(10);
  }

  // The end
  display.showString("End");
  delay(1000);
}

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 to help build your animation. The source code is in the 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:

// Data from Animator Tool
const uint8_t ANIMATION[12][4] = {
  { 0x08, 0x00, 0x00, 0x00 },  // Frame 0
  { 0x00, 0x08, 0x00, 0x00 },  // Frame 1
  { 0x00, 0x00, 0x08, 0x00 },  // Frame 2
  { 0x00, 0x00, 0x00, 0x08 },  // Frame 3
  { 0x00, 0x00, 0x00, 0x04 },  // Frame 4
  { 0x00, 0x00, 0x00, 0x02 },  // Frame 5
  { 0x00, 0x00, 0x00, 0x01 },  // Frame 6
  { 0x00, 0x00, 0x01, 0x00 },  // Frame 7
  { 0x00, 0x01, 0x00, 0x00 },  // Frame 8
  { 0x01, 0x00, 0x00, 0x00 },  // Frame 9
  { 0x20, 0x00, 0x00, 0x00 },  // Frame 10
  { 0x10, 0x00, 0x00, 0x00 }   // Frame 11
};

  // Display Animation sequence
  display.showAnimation(ANIMATION, FRAMES(ANIMATION), TIME_MS(50));

TM1637 6-Digit Display - TM1637TinyDisplay6

TM1637-6

6-Digit Display modules based on the TM1637 chip are available from Amazon and AliExpress.

TM1637-6-Back

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:

// Includes
#include <Arduino.h>
#include <TM1637TinyDisplay6.h>       // Include 6-Digit Display Class Header

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

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

void setup()
{
  display.begin();
  display.showString("digits");
  delay(1000);
  display.showNumber(123456);
  delay(1000);
  display.showNumber(123.456);
  delay(1000);
}

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 for information on available functions. See also Examples for more demonstration.

Arduino Library

References and Credit

tm1637tinydisplay's People

Contributors

hackerceo avatar jasonacox avatar kelevraslevin7 avatar mgesteiro avatar nerdralph avatar stef-ladefense avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tm1637tinydisplay's Issues

6-Digit Animation

Hi!
I think it’s a bug in the 6-digit lib.

showAnimation supports only the 4 digits in the middle, i think?

Unfortunately, my changes in the .h / .cpp from 4 to 6 did not work :-(

setBrightness : enhancement

I noticed that in the code, when you change the brightness or simply turn off the display, you have to do a setBrightness followed by rewriting the message.
It's counterproductive.
If for example I want to flash the display, at worst I have to do either:

for (uint8_t i = 0; i < 5; i++) {
display.setBrightness(7, false);
display.showNumber(_num, true);
delay(250);
display.setBrightness(7, true);
display.showNumber(_num, true);
delay(250);
}

or better not using setBrightness but rewriting the message all the same

for (uint8_t i = 0; i < 5; i++) {
display.clear();
delay(250);
display.showNumber(_num, true);
delay(250);
}

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.
this command doesn't need anything else to work.

display.showNumber(_num, true);
for (uint8_t i = 0; i < 5; i++) {
display.setBrightness(7, false);
delay(250) ;
display.setBrightness(7, true);
delay(250) ;
}

change in TM1637TinyDisplay.cpp

void TM1637TinyDisplay::setBrightness(uint8_t brightness, bool on)
{
  m_brightness = (brightness & 0x07) | (on? 0x08 : 0x00);
  
  start();
  writeByte(TM1637_I2C_COMM3 + (m_brightness & 0x0f));
  stop();
}


void TM1637TinyDisplay::setSegments(const uint8_t segments[], uint8_t length, uint8_t pos)
{
...
  // Write COMM3 + brightness
  //start();
  //writeByte(TM1637_I2C_COMM3 + (m_brightness & 0x0f));
  //stop();
}

tested on my current project and works without any observed side effects.
What do you think ?

Stephane

Add flip display left/right

Is it possible to flip the display also from left to right so that together with the flipDisplay() function the display would be seen correctly in the mirror, like for example head up display in a car's windscreen?
thank you

How to show colon?

Hi! I have a display from eBay which has the 4 digits and the colon in the middle. I've been reading through but can't figure out how to get the colon to flash. I'm obviously missing something but I don't know what? Any suggestions?

I am trying to make a clock and using the Time library i have done:

display.showNumber(hour(), true, 2,0);
display.showNumber(minute(), true, 2,2);

and would like to have the colon flash between the hour and minute

Using 4 and 6 digit displays at the same time

Question from @Kravatox

I have another question, in my code I use two display, one with 4 digits and another with 6 digits, and when I include TM1637TinyDisplay.h library and TM1637TinyDisplay6.h I have this error : "warning: "MAXDIGITS" redefined" and "warning: "FRAMES" redefined". Is there any solution to use both library the same time ?

Compile warnings

When I do the first compile of a new project (or Clean then compile), I receive several warnings.

None of these warning appear to be anything serious and the project works fine - it's really just cosmetic.

The first two warning relate to the redefinition af the labs macro:

lib\TM1637TinyDisplay\TM1637TinyDisplay.cpp:32:0: warning: "labs" redefined
 #define labs(x) ((x)>0?(x):-(x))

In file included from lib\TM1637TinyDisplay\TM1637TinyDisplay.cpp:24:0:
c:\users\andre\.platformio\packages\toolchain-atmelavr\avr\include\stdlib.h:132:0: note: this is the location of the previous definition
 #define labs(__i) __builtin_labs(__i)

lib\TM1637TinyDisplay\TM1637TinyDisplay6.cpp:32:0: warning: "labs" redefined
 #define labs(x) ((x)>0?(x):-(x))

In file included from lib\TM1637TinyDisplay\TM1637TinyDisplay6.cpp:24:0:
c:\users\andre\.platformio\packages\toolchain-atmelavr\avr\include\stdlib.h:132:0: note: this is the location of the previous definition
 #define labs(__i) __builtin_labs(__i)

The second group of warnings are all int/unsigned int mismatch in for loops:

lib\TM1637TinyDisplay\TM1637TinyDisplay.cpp: In member function 'void TM1637TinyDisplay::showString(const char*, uint8_t, uint8_t, uint8_t)':
lib\TM1637TinyDisplay\TM1637TinyDisplay.cpp:432:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int x = 0; x < strlen(s); x++) {
                     ~~^~~~~~~~~~~
lib\TM1637TinyDisplay\TM1637TinyDisplay.cpp: In member function 'void TM1637TinyDisplay::showString_P(const char*, uint8_t, uint8_t, uint8_t)':
lib\TM1637TinyDisplay\TM1637TinyDisplay.cpp:483:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int x = 0; x < strlen_P(s); x++) {
                     ~~^~~~~~~~~~~~~
lib\TM1637TinyDisplay\TM1637TinyDisplay.cpp: In member function 'bool TM1637TinyDisplay::Animate(bool)':
lib\TM1637TinyDisplay\TM1637TinyDisplay.cpp:614:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if (offset >= 0 && offset < m_animation_frames - (2 * MAXDIGITS)) {
                                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib\TM1637TinyDisplay\TM1637TinyDisplay.cpp:625:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if (offset >= 0 && offset < m_animation_frames - (2 * MAXDIGITS)) {
                                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling .pio\build\attiny84_via_arduino_ISP\FrameworkArduino\HardwareSerial.cpp.o
lib\TM1637TinyDisplay\TM1637TinyDisplay6.cpp: In member function 'void TM1637TinyDisplay6::showString(const char*, uint8_t, uint8_t, uint8_t)':
lib\TM1637TinyDisplay\TM1637TinyDisplay6.cpp:435:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int x = 0; x < strlen(s); x++) {
                     ~~^~~~~~~~~~~
lib\TM1637TinyDisplay\TM1637TinyDisplay6.cpp: In member function 'void TM1637TinyDisplay6::showString_P(const char*, uint8_t, uint8_t, uint8_t)':
lib\TM1637TinyDisplay\TM1637TinyDisplay6.cpp:486:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int x = 0; x < strlen_P(s); x++) {
                     ~~^~~~~~~~~~~~~
lib\TM1637TinyDisplay\TM1637TinyDisplay6.cpp: In member function 'bool TM1637TinyDisplay6::Animate(bool)':
lib\TM1637TinyDisplay\TM1637TinyDisplay6.cpp:617:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if (offset >= 0 && offset < m_animation_frames - (2 * MAXDIGITS)) {
                                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib\TM1637TinyDisplay\TM1637TinyDisplay6.cpp:628:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if (offset >= 0 && offset < m_animation_frames - (2 * MAXDIGITS)) {

System configuration:
Using VS Code (1.85.1 date 2023-12-13)
PlatformIO (v3.3.2)
Windows 10 home v 10.0.19045

Outputting to display significantly slows down entire sketch, not sure why.

Hi, so I have a thread on the arduino forum where I'm working on a countdown timer where you enter the time with a matrix keypad, and the desired behavior is that if the time is one hour or greater, the display shows it as such

02.25.30

as in two hours, 25 minutes, 30 seconds.

Then, when it drops to one hour and below, I want to have milliseconds update on the display, so it all shifts over like so

59.30.12

59 minutes, 30 seconds, 12ms

However, when I try to update the display at speed in my sketch it slows the whole thing down, basically making one second take three seconds. If I displayed the time in only milliseconds, without turning it into a two digit value, 700ms would take an entire three seconds to change to 600ms, however, the last two digits update extremely fast without any issue.

Its really peculiar, and the sketch being slowed down is fixed by commenting out the display.showNumberDec line, so it's somehow related to the output.

I figure you might be able to help or have a clue as to why this is, the display is clearly able to update extremely fast, but for some reason in this sketch, it bogs down.

Heres my forum thread, with the later few posts being the one cracking down on identifying the issue. https://forum.arduino.cc/t/need-help-setting-up-a-countdown-timer-which-you-set-using-a-keypad/864081/43

`#include <TM1637TinyDisplay6.h>
//
//// Module connection pins (Digital Pins)
#define CLK 10
#define DIO 11

TM1637TinyDisplay6 display(CLK, DIO);
unsigned long dispout;

byte hours = 0;
byte minutes = 12;
byte seconds = 10;

//number of milliseconds;
unsigned long counter = ((hours * 3600ul) + (minutes * 60ul) + seconds ) * 1000ul;

unsigned long timeMICROS;
unsigned long secondMICROS;
unsigned long timeMillis;

unsigned long num;
unsigned long leftDecimal;
unsigned long rightDecimal;

unsigned long HOURS;
unsigned long temp;
unsigned long MINUTES;
unsigned long SECONDS;
unsigned long MILLISECONDS;

void setup()
{
display.setBrightness(BRIGHT_LOW);
display.clear();
display.showString("boot");

Serial.begin(115200); // <---------------------<<<<<<<<<<<<<<<<<

Serial.println("Start the count down");

} //END of setup()

void loop()
{
unsigned long timeNow = micros();

//*****************************************
//every 1ms do this
if (timeNow - timeMICROS >= 1000)
{
//restart the TIMER
timeMICROS = timeMICROS + 1000;

counter = counter - 1;

}

//*****************************************
// RAW 10X milliseconds
//every 10ms
// if (timeNow - secondMICROS >= 10000) //10000 = 10ms
// {
//restart the TIMER
//secondMICROS = timeNow;

//restart the TIMER
// secondMICROS = secondMICROS + 10000;

// num = counter;
// leftDecimal = num / 1000;
// rightDecimal = (counter - leftDecimal * 1000) / 10;
// Serial.print("Milliseconds = ");
// Serial.print(leftDecimal);
// Serial.print(".");
// Serial.println(rightDecimal);
// }

//*****************************************
//every 10ms do this
//if (millis() - timeMillis >= 10)

//every 100ms do this
if (millis() - timeMillis >= 100)
{
//restart the TIMER every 10ms
timeMillis = timeMillis + 10;

//restart the TIMER every 100m
//timeMillis = timeMillis + 100;

//total number of seconds
HOURS = counter / 1000ul;
temp = (HOURS / 3600) * 3600;
MINUTES = HOURS - temp;
temp = (MINUTES / 60) * 60;

SECONDS = MINUTES - temp;
MINUTES = MINUTES / 60;
HOURS = HOURS / 3600;
MILLISECONDS = (counter % 1000) / 10;

Serial.print("Counter = ");
if(HOURS < 10)
{
  Serial.print(0);
}
Serial.print(HOURS);
Serial.print(":");
if(MINUTES < 10)
{
  Serial.print(0);
}
Serial.print(MINUTES);
Serial.print(":");
if(SECONDS < 10)
{
  Serial.print(0);
}
Serial.print(SECONDS);
Serial.print(".");
Serial.println(MILLISECONDS);

}

// dispout = ((HOURS * 10000) + (MINUTES * 100) + SECONDS); //This one if timer is above one hour
dispout = ((MINUTES * 10000) + (SECONDS * 100) + MILLISECONDS); //This one if timer is below one hour

uint8_t dots = 0b01010000;
display.showNumberDec(dispout, dots);

}
`

Enhanced character set

Enhanced character set

Dear Jason,
I love your tiny display library, it is excellent! However I think the character set could be improved and suggest the following changes:
Sym Hex Proposal Current
a 5F 01011111 01110111
e 7B 01111011 01111001
i 10 00010000 00000100
j 0E 00001110 00011110
k 70 01110000 01110110
K 72 01110010 01110110
{ 46 01000110 00111001
l 30 00110000 00110000
} 70 01110000 00001111
~ 04 00000100 01000000
≡ 49 01001001 addition
° 63 01100011 addition
¬ 44 01000100 addition
º 6B 01101011 addition
ǁ 36 00110110 addition
@ 7B 01111011 addition
˽ 1C 00011100 addition
’ 02 00000010 addition
< 61 01100001 00111001

43 01000011 00001111
≤ 69 01101001 addition
≥ 4B 01001011 addition
M 33 00110011 -
m 27 00100111 -
Mm Upper M See attached file. Makes a proper upper M
nn Lower m See attached file. Makes a proper lower m
W 1E 00011110 -
w 3C 00111100 -
Ww Upper W See attached file. Makes a proper upper W
uu Lower w See attached file. Makes a proper lower w

Would you please consider changing this? Would be very, very nice!

Jeroen Brinkman

Platformio shows only version 1.1.0 on M1 processors

Searching for the library in Platformio PIO Home (Mac with M1 processor, VC) shows only the 1.1.0 version (the changelog in VC shows all versions). If I try to update it manually (platformio.ini), I get a following error:

Library Manager: Removing TM1637TinyDisplay @ 1.1.0
Library Manager: [email protected] has been removed!
Library Manager: Installing jasonacox/TM1637TinyDisplay @ ^1.10.0
Error: Could not find the package with 'jasonacox/TM1637TinyDisplay @ ^1.10.0' requirements for your system 'darwin_arm64'

Rotate display

Hello, can you create a function for 180 degree rotation? Congratulations on your work.

showNumber - call of overloaded 'showNumber(double, bool, int, int)' is ambiguous

Hi,

Thank you so much for this library!
I am trying to display 2 decimal numbers , one on the left side of the screen and one on the right side.
This works perfectly:
display1.showNumber(160, false, 3, 0);
display1.showNumber(111, false, 3, 3);
But this is giving me an error:
display1.showNumber(1.60, false, 3, 0);
display1.showNumber(1.11, false, 3, 3);

call of overloaded 'showNumber(double, bool, int, int)' is ambiguous

Can you please point me in the right direction?

thanks!

store arrays in flash

If you store the segment arrays like digitToSegment in PROGMEM it reduces the RAM usage.

compile issue on raspberry pi pico

  • I have been using your library with arduino, STM32 Nucleo 64 F103rb without issues for several years and I love the library!! I was transferring code to raspberry pi Pico and got these compile errors. I'm using visual studio with visual micro extension. Any suggestions to modify the .h file is welcome.

tm1637tinydisplay.cpp:29: In file included from
tm1637tinydisplay.h: 34:6: error: expected unqualified-id before 'const
   34 |   (*(const unsigned char *)(addr)) \\ workaround for non-AVR
   |      ^~~~~
pgmspace.h:116: note  in expansion of macro pgm_read_byte
   116 | static inline unsigned char pgm_read_byte(const void *addr) {
   |                             ^~~~~~~~~~~~~

Will not accept an unsigned int

Hi, I am using your lib on a 6 digit display. I am using #include <TM1637TinyDisplay6.h>
When I assign an int value to a variable such as
int zx = 9999;
display.showNumber(zx);

This works fine but when I do

unsigned int zx = 999999;
display.showNumber(zx);

I get the compile error:

Compilation error: call of overloaded 'showNumber(unsigned int&)' is ambiguous

Any workarounds?

Error compile with 1.7 and esp8266 core 3.02

Hi,

have error ...
idea ?

D:\Arduino\libraries\TM1637TinyDisplay\TM1637TinyDisplay.cpp: In member function 'void TM1637TinyDisplay::startAnimation(const uint8_t (*)[4], unsigned int, unsigned int, bool)':
D:\Arduino\libraries\TM1637TinyDisplay\TM1637TinyDisplay.cpp:641:28: warning: invalid conversion from 'const uint8_t (*)[4] {aka const unsigned char (*)[4]}' to 'uint8_t (*)[4] {aka unsigned char (*)[4]}' [-fpermissive]
     m_animation_sequence = data;
                            ^~~~
D:\Arduino\libraries\TM1637TinyDisplay\TM1637TinyDisplay.cpp: At global scope:
D:\Arduino\libraries\TM1637TinyDisplay\TM1637TinyDisplay.cpp:651:100: warning: default argument given for parameter 3 of 'void TM1637TinyDisplay::startStringScroll(const char*, unsigned int, bool)' [-fpermissive]
 void TM1637TinyDisplay::startStringScroll(const char (*s), unsigned int ms, bool usePROGMEM = false) {
                                                                                                    ^
In file included from D:\Arduino\libraries\TM1637TinyDisplay\TM1637TinyDisplay.cpp:29:0:
D:\Arduino\libraries\TM1637TinyDisplay/TM1637TinyDisplay.h:434:8: note: previous specification in 'void TM1637TinyDisplay::startStringScroll(const char*, unsigned int, bool)' here
   void startStringScroll(const char s[], unsigned int ms = DEFAULT_SCROLL_DELAY, bool usePROGMEM = false);
        ^~~~~~~~~~~~~~~~~
D:\Arduino\libraries\TM1637TinyDisplay\TM1637TinyDisplay.cpp: In member function 'void TM1637TinyDisplay::startStringScroll(const char*, unsigned int, bool)':
D:\Arduino\libraries\TM1637TinyDisplay\TM1637TinyDisplay.cpp:677:26: warning: invalid conversion from 'const char*' to 'uint8_t* {aka unsigned char*}' [-fpermissive]
     m_animation_string = s;
                          ^

Fixed add negative sign for negative double

Hi,

for example that is note rendered correctly:
display.showNumber(-3.1, 1, 3, 1);

The solution is to add the negative sign for negative numbers inside the for loop, see attached code which works for both the 4 and the 6 segments versions:
showNumber-double.txt

All the best,
Oliver

Large number in showNumberDec (6 digits) displayed incorrectly.

I was trying to display "YY.MM.DD" on a 6 digit TM1637 display using showNumberDec (for example, "210410"), but the number displayed was incorrect.
Tracked it down to large number 210000 (although, did not test the limit) causes the problem.
Fixed it locally by changing showNumberDec's first parameter (num), and showNumberBaseEx's second parameter (num) to double (both in TM1637TinyDisplay6.cpp and TM1637TinyDisplay6.h).
But, didn't test the implications of this "fix" for negative numbers or border cases.

**Avoid** pinMode() and digitalWrite() in constructor()

Hi there,

It seems to work but, are you aware that you should NOT use pinMode() or any other hardware related functions before the main setup() method is invoked (i.e. after the hidden main() is executed)? If you do so in the constructor (like in the examples) you are risking a malfunction depending on how the code is linked:

https://forum.arduino.cc/t/pinmode-in-class-constructor-seem-not-to-work/370583

A begin() or init() method called during setup() is the recommended way.

If you want, I can provide a PR for this: just let me know.

Best regards

float decimal bug

Hey so I love your library, and the animations are dope, but i'm trying to do a time display. If I had a way to turn on the colon leds in the middle then I could just use the showString to display the time. This would actually be preferable cause then i could make the colon blink on and off every second, but I couldn't figure out how to do that, it seems like you only show the colon by way of decimal points in the showFloat. This works fine for double digit hours. 11.40 shows up fine as 11:40. But 1.40 comes out as 140 with no semi colon. Am I doing something wrong?

Thanks!

bug in flipdisplay with colon :

hi,

i use this for write time

void ShowTime(uint8_t _mins, uint8_t _secs, bool _Colon, bool _zns) {
display.showNumberDec(_mins, 0b01000000 * _Colon, _zns, 2, 0);
display.showNumber(_secs, true, 2, 2);
}

but with display.flipDisplay(true) not colon write ...

How can I represent a number with a decimal point ?

The library is very good, but so far I have not been able to represent numbers with a decimal point. In my project, I would like to realize a temperature display and would have to display "12.3°", for example. I tried the following call:
display.showString("\xB0", 1, 3); Test with suffix
display.showNumber(12.3, 4, 3, 0);
However, 12:3° appears in the display. When I look at the library file, it looks like this with the command "showNumberDec" should be possible.
Unfortunately I don't know which parameters I have to pass here. I would be very grateful for a small example. Kind regards, Daniel

[NEWBIE] Display seconds with blink dots ?

Hello,

Thank @jasonacox for your hard work on this usefull library! 👍🏻

I would like to create a custom timer but being limited to 4 digits I would like to use the "dots" to display the seconds with blink effect/animation.

I created this animation thanks to your super tool but being beginner I can't place it in my code. Could you help me ?

/* Animation Data - HGFEDCBA Map */
const uint8_t DOTBLINK[53][4] = {
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 0
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 1
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 2
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 3
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 4
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 5
  { 0x40, 0x00, 0x00, 0x00 },  // Frame 6
  { 0x40, 0x40, 0x00, 0x00 },  // Frame 7
  { 0x40, 0x40, 0x40, 0x00 },  // Frame 8
  { 0x40, 0x40, 0x40, 0x40 },  // Frame 9
  { 0x00, 0x40, 0x40, 0x40 },  // Frame 10
  { 0x00, 0x00, 0x40, 0x40 },  // Frame 11
  { 0x00, 0x00, 0x00, 0x40 },  // Frame 12
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 13
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 14
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 15
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 16
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 17
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 18
  { 0x40, 0x00, 0x00, 0x00 },  // Frame 19
  { 0x40, 0x40, 0x00, 0x00 },  // Frame 20
  { 0x40, 0x40, 0x40, 0x00 },  // Frame 21
  { 0x40, 0x40, 0x40, 0x40 },  // Frame 22
  { 0x00, 0x40, 0x40, 0x40 },  // Frame 23
  { 0x00, 0x00, 0x40, 0x40 },  // Frame 24
  { 0x00, 0x00, 0x00, 0x40 },  // Frame 25
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 26
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 27
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 28
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 29
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 30
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 31
  { 0x40, 0x00, 0x00, 0x00 },  // Frame 32
  { 0x40, 0x40, 0x00, 0x00 },  // Frame 33
  { 0x40, 0x40, 0x40, 0x00 },  // Frame 34
  { 0x40, 0x40, 0x40, 0x40 },  // Frame 35
  { 0x00, 0x40, 0x40, 0x40 },  // Frame 36
  { 0x00, 0x00, 0x40, 0x40 },  // Frame 37
  { 0x00, 0x00, 0x00, 0x40 },  // Frame 38
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 39
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 40
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 41
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 42
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 43
  { 0x00, 0x00, 0x00, 0x00 },  // Frame 44
  { 0x40, 0x00, 0x00, 0x00 },  // Frame 45
  { 0x40, 0x40, 0x00, 0x00 },  // Frame 46
  { 0x40, 0x40, 0x40, 0x00 },  // Frame 47
  { 0x40, 0x40, 0x40, 0x40 },  // Frame 48
  { 0x00, 0x40, 0x40, 0x40 },  // Frame 49
  { 0x00, 0x00, 0x40, 0x40 },  // Frame 50
  { 0x00, 0x00, 0x00, 0x40 },  // Frame 51
  { 0x00, 0x00, 0x00, 0x00 }   // Frame 52
};```

Would it be possible in the future to include a "blink dots" function in your Library structure?

Thank & have a good day

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.