82 lines
1.7 KiB
C++
82 lines
1.7 KiB
C++
#include <Stream.h>
|
|
#include <Wire.h>
|
|
#include <LiquidCrystal_I2C.h>
|
|
|
|
LiquidCrystal_I2C lcd (0x3F, 20, 4);
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
lcd.begin();
|
|
lcd.backlight();
|
|
Elton();
|
|
|
|
//lcd.noBacklight();
|
|
//lcd.autoscroll();
|
|
//lcd.blink();
|
|
}
|
|
|
|
void loop() {
|
|
/*
|
|
// put your main code here, to run repeatedly:
|
|
for (int positionCounter = 0; positionCounter < 13; positionCounter++) {
|
|
// scroll one position left:
|
|
lcd.scrollDisplayLeft();
|
|
// wait a bit:
|
|
delay(150);
|
|
}
|
|
|
|
// scroll 29 positions (string length + display length) to the right
|
|
// to move it offscreen right:
|
|
for (int positionCounter = 0; positionCounter < 29; positionCounter++) {
|
|
// scroll one position right:
|
|
lcd.scrollDisplayRight();
|
|
// wait a bit:
|
|
delay(150);
|
|
}
|
|
|
|
// scroll 16 positions (display length + string length) to the left
|
|
// to move it back to center:
|
|
for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
|
|
// scroll one position left:
|
|
lcd.scrollDisplayLeft();
|
|
// wait a bit:
|
|
delay(150);
|
|
}
|
|
|
|
lcd.scrollDisplayLeft();
|
|
delay(200);
|
|
|
|
*/
|
|
|
|
|
|
// delay at the end of the full loop:
|
|
//delay(1000);
|
|
}
|
|
|
|
void Elton()
|
|
{
|
|
lcd.print("Bonjour Elton");
|
|
lcd.setCursor(0,1);
|
|
lcd.print("Manger des");
|
|
lcd.setCursor(0,2);
|
|
lcd.print("croquettes ?");
|
|
lcd.setCursor(0,3);
|
|
lcd.print("Promener ?");
|
|
}
|
|
|
|
void Kbd()
|
|
{
|
|
if (Serial.available()) {
|
|
// wait a bit for the entire message to arrive
|
|
delay(100);
|
|
// clear the screen
|
|
//lcd.clear();
|
|
// read all the available characters
|
|
while (Serial.available() > 0) {
|
|
// display each character to the LCD
|
|
lcd.write(Serial.read());
|
|
}
|
|
}
|
|
}
|
|
|