Skip to content

Instantly share code, notes, and snippets.

@carlosdelfino
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosdelfino/fd8de06b79a70daecd55 to your computer and use it in GitHub Desktop.
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.
#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