Hi
Without lcd.clear(); on the LCD I have a mess, when I put it in case # 1, the scrolling doesn't work, without it menu is working but on LCD I have flickering.
What is wrong?
byte lcdNumCols = 16;
#include <LcdBarGraph.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(PC15, PC14, PB5, PB6, PB8, PB9);
//LcdBarGraph lbg(&lcd, lcdNumCols); // -- creating
LcdBarGraph lbgURx(&lcd, 4, 0, 0); // -- First line at column 0
LcdBarGraph lbgUbal(&lcd, 4, 0, 1); // -- Second line at column 0
//------------------------
int botonState = 0, i;
byte lastButtonState = LOW;
byte ledState = LOW;
int t;
int z;
void setup()
{
Serial.begin(115200);
lcd.begin(16, 2);
lcd.begin(2, lcdNumCols);
}
//=========================================== end setup ===========================
void loop()
{
// ++++++++++++++++++++++++++++++++ menu ++++++++++++++++++++++++++++++++
if (digitalRead(PA15) == 0)
{
// botonState = (botonState + 1) % 3;
botonState = (botonState + 1) % 8;
delay (200);
}
lcd.setCursor(0, 0);
switch (botonState)
{
case 0:
lcd.clear();
lcd.print("#0 z ");
lcd.setCursor(6, 0);
lcd.print("z3");
lcd.setCursor(8, 0);
lcd.print("Vo ");
break;
case 1:
//lcd.clear(); // if i uncomment this line menu scrolling is not working
lcd.print("#1 B ");
lcd.print(" R ");
lcd.setCursor(11, 0);
lcd.print("UR");
lcd.setCursor(0, 1);
lcd.print("a ");
lcd.print( "amp " );
lcd.setCursor(10, 1);
lcd.print("f ");
break;
case 2:
lcd.clear();
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
lcd.print(" #2");
break;
case 3:
lcd.clear();
lcd.print("#3");
lcd.setCursor(12, 0);
lcd.print("U3");
break;
case 4:
lcd.clear();
lcd.print("#4 Z ");
lcd.print("z2");
lcd.setCursor(0, 1);
lcd.print(" abc ");
break;
case 5:
lcd.clear();
lcd.print("#5 ");
lcd.print(" A ");
lcd.setCursor(0, 1);
lcd.print("U1");
lcd.print(" V ");
break;
case 6:
lcd.clear();
lcd.print("#6"); //spare
lcd.print(" A stadion " );
lcd.setCursor(0, 1);
lcd.print(" wood ");
break;
case 7:
lcd.clear();
lcd.print("# 7");
lcd.setCursor(0, 1);
lcd.print(" nnnnn");
break;
}
//+++++++++++++++++++++++++++++++++ menu end +++++++++++++++++++++++
}
//============================== loop end ===================