Hello
I'm a newbee in Arduino and code in general. I'm trying to simply display texte to a LCD through the keyboard shield of the 1Sheeld.
Mostly, it works great !
I'm stuck at coding a smooth way to delete characters, and especially to go up to the first line when I have deleted all the characters (one by one) one the second line.
I would love to get the coordonate of the cursor to make it go to the first line when the second one is empty. Any way to do that ?
Here is what have so far :
void setup () {
OneSheeld.begin();
lcd.begin(16, 2);
lcd.print("Welcome to" );
lcd.setCursor(0,1);
lcd.print("Girls In A Band");
delay(5000);
lcd.clear();
AsciiKeyboard.setOnButtonChange(*displayCharacters);
}
void displayCharacters(char data)
{
if (data =='\b') {
lcd.rightToLeft();
lcd.print(" ");
lcd.leftToRight();
}
// I want th cursor to go back to the first line when the second one is clear, when the cursor is at (0,1)
else if ((data =='\b')&&(I'D LIKE TO GET CURSOR POSTION HERE) {
lcd.setCursor(16,0);
lcd.rightToLeft();
lcd.print(" ");
lcd.leftToRight();
}
else if (data =='\n'){
lcd.setCursor(0,1);
}
else {
lcd.write(data);
}
}
void loop(){
}
I hope i'm clear... Every bit of help would be much appreciated.
Thanks !