Hi, I'm beginner on arduino projects. Just create a program to print scrolled message. It works well, however I see some Chinese characters at the end of the first line and on the second line of LCD as well.
I also get some warnings, as well. Can you comment on what could be the reason?
Below you can find the program and the warning messages during compilation.
PROGRAM
/***********************************************************
- Description: LCD1602 display a string "Hello Gunay!" scrolling,
***********************************************************/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to "0x27") for a 16 chars and 2 line display
char array1[]="Hello Gunay! "; //the string to print on the LCD
int tim = 250; //the value of delay time
void setup(void)
{
lcd.init(); //initialize the lcd
lcd.backlight(); //turn on the backlight
}
void loop(void)
{
lcd.clear(); //clears the LCD screen and positions the cursor in the upper-left corner
lcd.setCursor(16,0); // set the cursor to column 16, line 1
for (int positionCounter2 = 0; positionCounter2 < 30; positionCounter2++)
{
lcd.scrollDisplayLeft(); //scrolls the contents of the display one space to the left.
lcd.print(array1[positionCounter2]); // Print a message to the LCD.
delay(tim); //wait for 250 microseconds
}
lcd.clear(); //clears the LCD screen and positions the cursor in the upper-left corner.
}
WARNING MESSAGES
D:\OneDrive\KARIŞIK\Projeler\Arduino\LCD Control 16_2\LCD_Scrolling_Message\LCD_Scrolling_Message.ino: In function 'loop':
D:\OneDrive\KARIŞIK\Projeler\Arduino\LCD Control 16_2\LCD_Scrolling_Message\LCD_Scrolling_Message.ino:25:16: warning: iteration 18 invokes undefined behavior [-Waggressive-loop-optimizations]
D:\OneDrive\KARIŞIK\Projeler\Arduino\LCD Control 16_2\LCD_Scrolling_Message\LCD_Scrolling_Message.ino:22:53: note: containing loop
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\main.cpp: In function 'main':
D:\OneDrive\KARIŞIK\Projeler\Arduino\LCD Control 16_2\LCD_Scrolling_Message\LCD_Scrolling_Message.ino:25:16: warning: iteration 18 invokes undefined behavior [-Waggressive-loop-optimizations]
D:\OneDrive\KARIŞIK\Projeler\Arduino\LCD Control 16_2\LCD_Scrolling_Message\LCD_Scrolling_Message.ino:22:53: note: containing loop
Sketch uses 2810 bytes (8%) of program storage space. Maximum is 32256 bytes.
Global variables use 261 bytes (12%) of dynamic memory, leaving 1787 bytes for local variables. Maximum is 2048 bytes.