Skip to content

Commit d4109ef

Browse files
committed
Merge branch 'develop'
2 parents 9071657 + 855105d commit d4109ef

16 files changed

+472
-286
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ libraries
33
sketches
44
/.project
55
*.h.gch
6+
.vscode

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ before_install:
33
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16"
44
- sleep 3
55
- export DISPLAY=:1.0
6-
- wget https://downloads.arduino.cc/arduino-1.6.8-linux64.tar.xz
7-
- tar xf arduino-1.6.8-linux64.tar.xz
8-
- sudo mv arduino-1.6.8 /usr/local/share/arduino
6+
- wget https://downloads.arduino.cc/arduino-1.8.12-linux64.tar.xz
7+
- tar xf arduino-1.8.12-linux64.tar.xz
8+
- sudo mv arduino-1.8.12 /usr/local/share/arduino
99
- sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino
1010
install:
1111
- ln -s $PWD /usr/local/share/arduino/libraries/SevenSegmentTM1637

README.md

+32-14
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,17 @@ If you use any of these super classes, you will also get all the basic, advanced
6969

7070
## Extended class extra methods
7171

72-
* `SevenSegmentExtended(clkPin, dioPin)`Creates a display object
73-
* `printTime(hour, min)` Prints the time to the display
74-
* `printDualCounter(leftValue, rightValue)` Prints two digits to the display
72+
* `SevenSegmentExtended(clkPin, dioPin)` Creates a display object
73+
* `printTime(hour, min, [blink], [blinkDelay])` Prints the time to the display
74+
* `printTime(time, [blink], [blinkDelay])` Prints the time to the display
75+
* `printDualCounter(leftValue, rightValue)` Prints two digits to the display
7576

7677
## Fun class extra methods
7778

78-
* `SevenSegmentFun(clkPin, dioPin)`Creates a display object
79-
* `printLevelVertical(level)` Prints 1-3 vertical levels e.g. volume, battery
80-
* `printLevelHorizontal(levels` Prints 4 horizontal levels e.g. equalizer
79+
* `SevenSegmentFun(clkPin, dioPin)` Creates a display object
80+
* `printLevelVertical(level, [leftToRight])` Print 0-100% (2 steps per digit) vertical level e.g. volume, battery
81+
* `printLevelVertical(level, leftToRight, symbol)` Print 0-100% (1 step per digit) vertical level using custom symbol
82+
* `printLevelHorizontal(levels[])` Prints 4 horizontal levels e.g. equalizer
8183
* `scrollingText()` Prints text and (keeps) scrolling
8284
* `snake()` Classic snake demo
8385
* `nightrider()` Nightrider Kit demo
@@ -86,6 +88,10 @@ If you use any of these super classes, you will also get all the basic, advanced
8688

8789
For more extended information on what arguments all above functions accept and return see the header files of the classes (SevenSegmentTM1637.h, SevenSegmentExtended.h and SevenSegmentFun.h).
8890

91+
# Trouble shooting
92+
93+
* Some boards might not have enough power on their 5V pin. In that case try to use an external 5V power supply. People reported that the ESP8266 might be one of those boards.
94+
8995
# Todo
9096

9197
* Refactor library to make it more modular and support more chips
@@ -95,16 +101,28 @@ For more extended information on what arguments all above functions accept and r
95101

96102
# Changelog
97103

98-
* 28-09-2015 version 1.0.0
99-
+ First release
100-
* 28-09-2015 version 1.0.1
101-
+ fixed folder structure to comply with Arduino library 1.5 rev 2 specifications
102-
* 08-05-2016 version 1.0.2
103-
+ fixed digitalHigh() macro for non AVR boards (thanks to [per1234](https://github.com/per1234))
104-
* 22-05-2016 version 1.0.3
105-
+ add support for all AVR MCU's (thanks to [per1234](https://github.com/per1234))
104+
+ 04-07-2020 version 1.1.0
105+
+ Improved `printLevelVertical()` using [pablo-lp](https://github.com/pablo-lp) suggestions
106+
+ The default `printLevelVertical()` can diplay twice the number of levels now (e.g. 9 levels for a defaulf 4 digit display)
107+
+ Add configurable blink delay when using the `printTime` methods (thanks to [simoneluconi](https://github.com/simoneluconi))
108+
+ Added a new `printNumber()` method to make it easier to print right aligned numbers
109+
+ Thanks [dan2600](https://github.com/dan2600), [Bilick88](https://github.com/Bilick88), [jasonacox](https://github.com/jasonacox) for your suggestions.
110+
+ Bug fixes
111+
+ Merge PR from [berendkleinhaneveld](https://github.com/berendkleinhaneveld) to fix some compiler warnings
112+
+ Merge PR from [facelessloser](https://github.com/facelessloser) Remove some `Serial.prinln()` calls
113+
+ Merge PR from [RAnders00](https://github.com/RAnders00) Fix incorrect repsonse from `comReadByte()`
114+
+ Merge PR from [per1234](https://github.com/per1234) Use correct separator in `keywords.txt`
106115
+ 04-11-2016 version 1.0.4
107116
+ Fixed bombTimer not counting down to zero (thanks to [foons](https://github.com/fooons) for opening an issue)
117+
* 22-05-2016 version 1.0.3
118+
+ add support for all AVR MCU's (thanks to [per1234](https://github.com/per1234))
119+
* 08-05-2016 version 1.0.2
120+
+ fixed digitalHigh() macro for non AVR boards (thanks to [per1234](https://github.com/per1234))
121+
* 28-09-2015 version 1.0.1
122+
+ fixed folder structure to comply with Arduino library 1.5 rev 2 specifications
123+
* 28-09-2015 version 1.0.0
124+
+ First release
125+
108126

109127
# Note
110128

examples/Basic/Basic.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/*
22
Basic usage example
33
4-
Demonstrated some of the basic functionality of the library. Initialize the display, set the backlight brightness, print some text, count from 0 to 100 and print on display and blink some text.
4+
Demonstrated some of the basic functionality of the library. Initialize the display,
5+
set the backlight brightness, print some text, count from 0 to 100 and
6+
print and blink some text.
57
68
Note: make sure to set your serial monitor to line end: NEW LINE!
79

examples/FunPrintLevel/FunPrintLevel.ino

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
#define PIN_DIO 5
88

99
// initialize TM1637 Display objects
10-
SevenSegmentTM1637 TM1637Display(PIN_CLK, PIN_DIO);
11-
SevenSegmentFun display(TM1637Display);
10+
SevenSegmentFun display(PIN_CLK, PIN_DIO);
1211

1312

1413
void setup() {
1514
// initialize the display
16-
TM1637Display.begin();
15+
display.begin();
1716
}
1817

1918
void loop() {

examples/PrintNumber/PrintNumber.ino

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
Printing numbers example
3+
4+
Demonstrate a couple different ways nubers can be printed: positive, negative,
5+
with padding and with rollover.
6+
7+
8+
The circuit:
9+
* connect TM1637 pin CLK to Arduino pin D4
10+
* connect TM1637 pin DIO to Arduino pin D5
11+
* connect TM1637 pin Vcc to Arduino pin 5V
12+
* connect TM1637 pin GND to Arduino pin GND
13+
14+
Created 22 June 2020
15+
By Bram Harmsen
16+
17+
https://github.com/bremme/arduino-tm1637
18+
19+
*/
20+
21+
// include the SevenSegmentTM1637 library
22+
#include "SevenSegmentTM1637.h"
23+
#include "SevenSegmentExtended.h"
24+
25+
/* initialize global TM1637 Display object
26+
* The constructor takes two arguments, the number of the clock pin and the digital output pin:
27+
* SevenSegmentTM1637(byte pinCLK, byte pinDIO);
28+
*/
29+
const byte PIN_CLK = 4; // define CLK pin (any digital pin)
30+
const byte PIN_DIO = 5; // define DIO pin (any digital pin)
31+
SevenSegmentExtended display(PIN_CLK, PIN_DIO);
32+
33+
// run setup code
34+
void setup() {
35+
Serial.begin(9600); // initializes the Serial connection @ 9600 baud
36+
display.begin(); // initializes the display
37+
display.setBacklight(100); // set the brightness to 100 %
38+
display.print("INIT"); // display INIT on the display
39+
delay(1000); // wait 1000 ms
40+
};
41+
42+
// run loop (forever)
43+
void loop() {
44+
45+
// print positive numbers
46+
display.print("PRINT POSITIVE NUMBERS");
47+
delay(1000); // wait 1000 ms
48+
for (int16_t number=0; number < 2000; number++) {
49+
display.printNumber(number);
50+
delay(1);
51+
};
52+
53+
// print negative numbers
54+
display.print("PRINT NEGATIVE NUMBERS");
55+
delay(1000); // wait 1000 ms
56+
for (int16_t number=0; number > -999; number--) {
57+
display.printNumber(number);
58+
delay(2);
59+
};
60+
61+
// print with positive with zero padding
62+
display.print("PRINT POSITIVE NUMBERS WITH PADDING");
63+
delay(1000); // wait 1000 ms
64+
for (int16_t number=0; number < 2000; number++) {
65+
display.printNumber(number, true);
66+
delay(1);
67+
};
68+
69+
// print with rollover (e.g. 10000 -> 0, 10001 -> 1)
70+
display.print("PRINT POSITIVE NUMBERS WITH ROLLOVER");
71+
delay(1000); // wait 1000 ms
72+
for (int16_t number=0; number < 20000; number+=250) {
73+
display.printNumber(number, false, true);
74+
delay(50);
75+
};
76+
};

keywords.txt

+18-8
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,42 @@ SevenSegmentFun KEYWORD1
1414
# Methods and Functions (KEYWORD2)
1515
#######################################
1616

17-
write KEYWORD2
1817
init KEYWORD2
1918
begin KEYWORD2
19+
write KEYWORD2
2020
clear KEYWORD2
2121
home KEYWORD2
22+
setCursor KEYWORD2
23+
setBacklight KEYWORD2
24+
setContrast KEYWORD2
2225
on KEYWORD2
2326
off KEYWORD2
24-
printRaw KEYWORD2
25-
printTime KEYWORD2
26-
printDualCounter KEYWORD2
2727
blink KEYWORD2
28-
setBacklight KEYWORD2
29-
setContrast KEYWORD2
30-
setCursor KEYWORD2
3128
setColonOn KEYWORD2
3229
getColonOn KEYWORD2
3330
setPrintDelay KEYWORD2
3431
encode KEYWORD2
35-
encode KEYWORD2
3632
shiftLeft KEYWORD2
33+
printRaw KEYWORD2
3734
command KEYWORD2
3835
comReadByte KEYWORD2
3936
comWriteByte KEYWORD2
4037
comStart KEYWORD2
4138
comStop KEYWORD2
4239
comAck KEYWORD2
40+
printTime KEYWORD2
41+
printNumber KEYWORD2
42+
printDualCounter KEYWORD2
43+
printLevelVertical KEYWORD2
44+
printLevelHorizontal KEYWORD2
45+
scrollingText KEYWORD2
46+
snake KEYWORD2
47+
nightrider KEYWORD2
48+
bombTimer KEYWORD2
49+
bouchingBall KEYWORD2
50+
printBall KEYWORD2
51+
print4Bit KEYWORD2
52+
4353

4454
#######################################
4555
# Constants (LITERAL1)

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SevenSegmentTM1637
2-
version=1.0.0
2+
version=1.1.0
33
author=Bram Harmsen <[email protected]>
44
maintainer=Bram Harmsen <[email protected]>
55
sentence=Library for using a 4 digit seven segment display with TM1636 or TM1637 driver IC

src/SevenSegmentAsciiMap.cpp

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#include "SevenSegmentAsciiMap.h"
2+
3+
// store an ASCII Map in PROGMEM (Flash memory)
4+
const uint8_t AsciiMap::map[] PROGMEM = {
5+
TM1637_CHAR_SPACE,
6+
TM1637_CHAR_EXC,
7+
TM1637_CHAR_D_QUOTE,
8+
TM1637_CHAR_POUND,
9+
TM1637_CHAR_DOLLAR,
10+
TM1637_CHAR_PERC,
11+
TM1637_CHAR_AMP,
12+
TM1637_CHAR_S_QUOTE,
13+
TM1637_CHAR_L_BRACKET,
14+
TM1637_CHAR_R_BRACKET,
15+
TM1637_CHAR_STAR,
16+
TM1637_CHAR_PLUS,
17+
TM1637_CHAR_COMMA,
18+
TM1637_CHAR_MIN,
19+
TM1637_CHAR_DOT,
20+
TM1637_CHAR_F_SLASH,
21+
TM1637_CHAR_0, // 48 (ASCII)
22+
TM1637_CHAR_1,
23+
TM1637_CHAR_2,
24+
TM1637_CHAR_3,
25+
TM1637_CHAR_4,
26+
TM1637_CHAR_5,
27+
TM1637_CHAR_6,
28+
TM1637_CHAR_7,
29+
TM1637_CHAR_8,
30+
TM1637_CHAR_9,
31+
TM1637_CHAR_COLON,
32+
TM1637_CHAR_S_COLON,
33+
TM1637_CHAR_LESS,
34+
TM1637_CHAR_EQUAL,
35+
TM1637_CHAR_GREAT,
36+
TM1637_CHAR_QUEST,
37+
TM1637_CHAR_AT,
38+
TM1637_CHAR_A, // 65 (ASCII)
39+
TM1637_CHAR_B,
40+
TM1637_CHAR_C,
41+
TM1637_CHAR_D,
42+
TM1637_CHAR_E,
43+
TM1637_CHAR_F,
44+
TM1637_CHAR_G,
45+
TM1637_CHAR_H,
46+
TM1637_CHAR_I,
47+
TM1637_CHAR_J,
48+
TM1637_CHAR_K,
49+
TM1637_CHAR_L,
50+
TM1637_CHAR_M,
51+
TM1637_CHAR_N,
52+
TM1637_CHAR_O,
53+
TM1637_CHAR_P,
54+
TM1637_CHAR_Q,
55+
TM1637_CHAR_R,
56+
TM1637_CHAR_S,
57+
TM1637_CHAR_T,
58+
TM1637_CHAR_U,
59+
TM1637_CHAR_V,
60+
TM1637_CHAR_W,
61+
TM1637_CHAR_X,
62+
TM1637_CHAR_Y,
63+
TM1637_CHAR_Z,
64+
TM1637_CHAR_L_S_BRACKET, // 91 (ASCII)
65+
TM1637_CHAR_B_SLASH,
66+
TM1637_CHAR_R_S_BRACKET,
67+
TM1637_CHAR_A_CIRCUM,
68+
TM1637_CHAR_UNDERSCORE,
69+
TM1637_CHAR_A_GRAVE, // 96 (ASCII)
70+
TM1637_CHAR_a,
71+
TM1637_CHAR_b,
72+
TM1637_CHAR_c,
73+
TM1637_CHAR_d,
74+
TM1637_CHAR_e,
75+
TM1637_CHAR_f,
76+
TM1637_CHAR_g,
77+
TM1637_CHAR_h,
78+
TM1637_CHAR_i,
79+
TM1637_CHAR_j,
80+
TM1637_CHAR_k,
81+
TM1637_CHAR_l,
82+
TM1637_CHAR_m,
83+
TM1637_CHAR_n,
84+
TM1637_CHAR_o,
85+
TM1637_CHAR_p,
86+
TM1637_CHAR_q,
87+
TM1637_CHAR_r,
88+
TM1637_CHAR_s,
89+
TM1637_CHAR_t,
90+
TM1637_CHAR_u,
91+
TM1637_CHAR_v,
92+
TM1637_CHAR_w,
93+
TM1637_CHAR_x,
94+
TM1637_CHAR_y,
95+
TM1637_CHAR_z,
96+
TM1637_CHAR_L_ACCON, // 123 (ASCII)
97+
TM1637_CHAR_BAR,
98+
TM1637_CHAR_R_ACCON,
99+
TM1637_CHAR_TILDE // 126 (ASCII)
100+
};

0 commit comments

Comments
 (0)