Skip to content

Commit 5c47451

Browse files
committed
Updated ledtest to have the latest library, and an experimental K
1 parent 4f61d4d commit 5c47451

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

ledtest/LEDDisplayDriver.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,14 @@ void LEDDisplayDriver::showText(const char *msg, byte first, byte count) {
428428

429429
#ifdef _INCLUDE_SCROLLING_TEXT_
430430
void LEDDisplayDriver::showTextScroll(const char *msg, byte first, byte count) {
431-
for (byte i = 0; i <= strlen(msg) - count; i++) {
431+
byte end;
432+
if (count >= strlen(msg)) {
433+
end = 0;
434+
} else {
435+
end = strlen(msg) - count;
436+
}
437+
438+
for (byte i = 0; i <= end; i++) {
432439
showText(msg + i, first, count);
433440
if (!autoUpdate) update();
434441
delay(scrollDelay);

ledtest/LEDDisplayDriver.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
//#define _USE_TIMER4_ // Supported on Mega2560 & Mega32U4
4747
//#define _USE_TIMER5_ // Supported on Mega2560
4848

49-
#define MAX_DIGITS 8 // Used to reserve frame buffer
49+
#define MAX_DIGITS 16 // Used to reserve frame buffer
5050

5151
// Limits how fast the pins change state
5252
// Using 10 gives slow and stable signals, 1 is the fastest with any delay and 0 is crazy fast when _FAST_CLOCK_ is enabled
@@ -89,7 +89,7 @@
8989

9090
// Display types that needs a 3. pin, i.e. load
9191
// The condition is reversed because most displays use 3 pins
92-
#if !(defined(_TM1637_) || defined(_TM1637_6DX_) || defined(_TM1637_COLON_)|| defined(_HC164_) || defined(_HT16K33_8D_) || defined(_HT16K33_14SEG_8D_) || defined(_HT16K33_14SEG_8D_) || defined(_HT16K33_4D_))
92+
#if !(defined(_TM1637_) || defined(_TM1637_6DX_) || defined(_TM1637_COLON_)|| defined(_HC164_) || defined(_HT16K33_8D_) || defined(_HT16K33_14SEG_8D_) || defined(_HT16K33_14SEG_4D_) || defined(_HT16K33_4D_))
9393
#define _DATA_BIDIRECTIONAL_
9494
#define _USE_LOAD_
9595
#endif
@@ -869,7 +869,7 @@ const DIGIT_TYPE digitG = SEG_A | SEG_C | SEG_D | SEG_E | SEG_F | SEG_H;
869869
const DIGIT_TYPE digitH = SEG_B | SEG_C | SEG_E | SEG_F | SEG_G | SEG_H;
870870
const DIGIT_TYPE digitI = SEG_A | SEG_D | SEG_L | SEG_O;
871871
const DIGIT_TYPE digitJ = SEG_B | SEG_C | SEG_D | SEG_E;
872-
const DIGIT_TYPE digitK = SEG_E | SEG_F | SEG_G | SEG_M | SEG_P;
872+
const DIGIT_TYPE digitK = SEG_E | SEG_F | SEG_G | SEG_M | SEG_H | SEG_C;
873873
const DIGIT_TYPE digitL = SEG_D | SEG_E | SEG_F;
874874
const DIGIT_TYPE digitM = SEG_B | SEG_C | SEG_E | SEG_F | SEG_K | SEG_M;
875875
const DIGIT_TYPE digitN = SEG_B | SEG_C | SEG_E | SEG_F | SEG_K | SEG_P;

ledtest/ledtest.ino

+13-13
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Manual for library: http://lygte-info.dk/project/DisplayDriver%20UK.html
55

6-
const byte numberOfDigits = 12;
6+
const byte numberOfDigits = 16;
77
const byte dataPin = A4;
88
const byte clockPin = A5;
99
const byte loadPin = A2;
@@ -13,30 +13,30 @@ LEDDisplayDriver display(dataPin, clockPin, loadPin);
1313
void setup() {
1414
Serial.begin(9600);
1515
Serial.println("Hello ledtest");
16-
//
17-
// for (int i = 0; i < 255; ++i) {
18-
// if (!isprint(i)) continue;
19-
// display.showChar(i % 4, i);
20-
// delay(200);
21-
// }
22-
// // display.showDigit(SEG_A | SEG_B | SEG_H | SEG_G | SEG_F, 0);
23-
// delay(5000);
16+
//
17+
// for (int i = 0; i < 255; ++i) {
18+
// if (!isprint(i)) continue;
19+
// display.showChar(i % 4, i);
20+
// delay(200);
21+
// }
22+
// // display.showDigit(SEG_A | SEG_B | SEG_H | SEG_G | SEG_F, 0);
23+
// delay(5000);
2424
display.showTextScroll("Tell me something");
2525
}
2626

2727

28-
char displayBuffer[4] = {' ', ' ', ' ', ' '};
28+
char displayBuffer[16] = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '};
2929

3030
void loop() {
3131
char c = Serial.read();
3232
if (! isprint(c)) return; // only printable!
3333

3434
// scroll down display
35-
for (int i = 0; i < 3; ++i) {
35+
for (int i = 0; i < 15; ++i) {
3636
displayBuffer[i] = displayBuffer[i + 1];
3737
}
38-
displayBuffer[3] = c;
39-
for (int i = 0 ; i < 4; ++i) {
38+
displayBuffer[15] = c;
39+
for (int i = 0 ; i < 16; ++i) {
4040
display.showChar(i, displayBuffer[i]);
4141
}
4242
delay(200);

0 commit comments

Comments
 (0)