Last active
August 29, 2015 14:04
-
-
Save carlosdelfino/fd8de06b79a70daecd55 to your computer and use it in GitHub Desktop.
Scrooll de uma linha em LCD, é preciso alguns ajustes, mas este é o caminho, o primeiro passo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LiquidCrystal.h> | |
#define DELAY_STR (500) | |
#define DELAY_BLOCK (300) | |
#define DELAY_CHAR (20) | |
#define DELAY_RESTART (500) | |
LiquidCrystal lcd1(7, 6, 12, 11, 10, 9); | |
// 0 1 2 3 | |
// 012345678901234567890123456789012345 | |
char strlcd[] = "Display para o Scroll na tela do lcd"; | |
int strlcdlen = 35; | |
void setup() { | |
lcd1.begin(16, 2); | |
lcd1.home(); | |
lcd1.print(strlcd); | |
lcd1.setCursor(0, 1); | |
lcd1.print("2 linhas/16 colunas"); | |
delay(1500); | |
} | |
void loop() { | |
static unsigned int col = 0; | |
lcd1.setCursor(0, 0); | |
lcd1.print(strlcd); | |
delay(DELAY_STR); | |
for (unsigned int colstr = 1; colstr <= strlcdlen-1 ; colstr++) { | |
char tmpcol = strlcd[colstr]; | |
lcd1.setCursor(col++, 0); | |
lcd1.print(tmpcol); | |
if (col > 15) { | |
col = 0; | |
colstr -= (15); | |
delay(DELAY_BLOCK); | |
} | |
delay(DELAY_CHAR); | |
} | |
delay(DELAY_RESTART); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment