Skip to content

Better print method#2

Open
MikeDombo wants to merge 3 commits intoozhantr:masterfrom
MikeDombo:master
Open

Better print method#2
MikeDombo wants to merge 3 commits intoozhantr:masterfrom
MikeDombo:master

Conversation

@MikeDombo
Copy link
Copy Markdown

Added a better printing method which enables the decimal point, spaces, hyphens, and underscores.

MikeDombo and others added 3 commits August 24, 2017 16:44
Add hyphen and underscore, option to clear display or persist, and right
shift. Added field to hold the bytes currently on the display. Changed
constructor to add the digitLimit in the constructor.
@mperotto
Copy link
Copy Markdown

mperotto commented Aug 2, 2020

Sample code to print string with scroll
`
/* Include DigitLedDisplay Library */
#include "DigitLedDisplay.h"

/* Arduino Pin to Display Pin
7 to DIN,
6 to CS,
5 to CLK */
DigitLedDisplay ld = DigitLedDisplay(7, 6, 5);

const static byte charTable2 [] PROGMEM = {
B01111110, B00110000, B01101101, B01111001, B00110011, B01011011, B01011111, B01110000, // (0) 0123 4567
B01111111, B01111011, B01110111, B00011111, B00001101, B00111101, B01001111, B01000111, // (8) 89AB CDEF
B01100000, B00011000, B00001100, B01000010, B01101100, B01011010, B00110001, B00000111, // (16) •••• ••••
B01000000, B01001000, B01001001, B00000000, B00000000, B00000000, B00000000, B00000000, // (24) •••• ••••
B00000000, B00000000, B00100010, B00000000, B00000000, B00000000, B00000000, B00100000, // (32) ×"× ×××'
B01001110, B01111000, B01100011, B00000000, B10000000, B00000001, B10000000, B00100100, // (40) ()*× ,-./
B01111110, B00110000, B01101101, B01111001, B00110011, B01011011, B01011111, B01110000, // (48) 0123 4567
B01111111, B01111011, B00001001, B00000000, B00000000, B01000011, B01000001, B01100001, // (56) 89:× ×<=>
B00000000, B01110111, B01111111, B01001110, B00111101, B01001111, B01000111, B01011110, // (64) ×ABC DEFG
B00110111, B00000110, B00111100, B00100111, B00001110, B00110110, B01110110, B01111110, // (72) HIJK LMNO
B01100111, B01110011, B01100110, B01011011, B00001111, B00111110, B00100111, B00010011, // (80) PqRS tUVx
B00111111, B00111011, B01101101, B00000000, B00000000, B00010010, B01100010, B00001000, // (88) WYZ× ×^_
B00000010, B01110111, B00011111, B00001101, B00111101, B01001111, B01000111, B01011110, // (96) `Abc dEFG
B00010111, B00010000, B00111100, B00100111, B00110000, B00110110, B00010101, B00011101, //(104) hiJK lMno
B01100111, B01110011, B00000101, B01011011, B00001111, B00011100, B00100011, B00010011, //(112) PqrS tuvx
B00101010, B00111011, B01101101, B01101101, B00000110, B00000000, B00100101, B00000000 //(120) WYZ× |×~×
};

void setup() {

/* Set the brightness min:1, max:15 */
ld.setBright(8);

/* Set the digit count */
ld.setDigitLimit(8);

}

void loop() {

/* Clear all display value */
ld.clear();
delay(500);
ld.setBright(8);
print7Seg("ELETRONICA BRASIL - FACEBOOK - - -");
}

void print7Seg(String myString) {
unsigned int lastStringLength = myString.length();
int mid = 1;
int midfrom;
int scroll = 1;
do {
if (scroll < 8) scroll++; else delay(80);
midfrom = (mid + scroll) - 2;
marquee(midfrom, myString );
mid++;
delay(180);
} while (mid < lastStringLength);
}
void marquee(int midfrom, String myString) {
byte bin;
unsigned int lastStringLength = myString.length();
for (int lcd = 1; lcd <= 8; lcd++) {
if (midfrom >= lastStringLength) {
bin = pgm_read_byte_near(charTable2 + ' ');
delay(80 - (70 - (lcd * 10)));
}
else
{
bin = pgm_read_byte_near(charTable2 + myString.charAt(midfrom)); // pos 1 V
}
ld.write(lcd, bin); // lcd=1
midfrom --;
}
}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants