1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#include <Wire.h>
#include "DFRobot_LCD.h"
DFRobot_LCD lcd(16,2); //16 characters and 2 lines of show
const int delai_scrolling = 500; // fixe la valeur du délai de scrolling
char texte[32];// déclare la chaine appelée "texte" que l'on affichera sur le LCD, longueur max 32 à
// ajuster si trop long
void ScrollingLeft()
{
for (int positionCounter = 0; positionCounter < 32; positionCounter++)
{
// scroll one position left:
lcd.scrollDisplayLeft();
// wait a bit:
delay(delai_scrolling);
}
}
void ScrollingRight()
{
for (int positionCounter = 0; positionCounter < 32; positionCounter++)
{
// scroll one position right:
lcd.scrollDisplayRight();
// wait a bit:
delay(delai_scrolling);
}
}
void setup()
{
// initialize
strcpy(texte, "Hello world et encore Hello World");
lcd.init();
// Print a message to the LCD.
lcd.print(texte);
delay(1000);
}
void loop()
{
ScrollingLeft;
delay(1000);
ScrollingRight;
delay(1000);
} |
Partager