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 52 53 54 55 56 57 58
|
#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[33];// déclare la chaine appelée "texte" que l'on affichera sur le LCD, longueur max 32 à
// ajuster si trop long
void ScrollingLeft()
{
lcd.print(texte);
int text_length;
text_length=strlen(texte);
Serial.print("longueur text_length= ");
Serial.println(text_length);
for (int positionCounter = 0; positionCounter < text_length; positionCounter++)
{
// scroll one position left:
lcd.scrollDisplayLeft();
// wait a bit:
delay(delai_scrolling);
}
}
/*
void ScrollingRight()
{
for (int positionCounter = 0; positionCounter < 33; positionCounter++)
{
// scroll one position right:
lcd.scrollDisplayRight();
// wait a bit:
delay(delai_scrolling);
}
}
*/
void setup()
{
Serial.begin(9600); // initialisation Moniteur Serie
// initialize
strcpy(texte, "Hello world et encore");
lcd.init();
// Print a message to the LCD.
lcd.print(texte);
delay(1000);
}
void loop()
{
ScrollingLeft();
//delay(1000);
// ScrollingRight(); on ne teste que le ScrollinLeft, on verra plus tard
// delay(1000);
} |
Partager