I'm trying to program a super basic pokedex (yeah from pokemon) from an arduino uno and a 16,2 lcd display but I'm having a bit of trouble with the code. Basically all I'm looking to do is have the lcd screen display one page at a time like this
Line 1 NA: (name) NO:000
Line 2 TypeA:(type) TypeB:(type)
Stumbling my way through youtube tutorials I thought a good way to do this would be to use to use the switch case function (structure?) and wire 2 buttons for scrolling back and forth trough the pages. This is where I started having trouble. i can't figure out how to make a push button switch the case that is currently being displayed.
I have very limited knowledge when it comes to arduino and only understand how to use the more basic functions such as digital read and write and initializing pins so I'm sure I both sound like an idiot and am going about this completely wrong. And I apologies in advance for the "code" below (I think its readable). Thanks for any and all help!
#include <LiquidCrystal.h>
LiquidCrystal lcd (1, 2, 4, 5, 6, 7);
int pin13 = 13;
int pin12 = 12;
int pin11 = 11;
int pin10 = 10;
int pin9 = 9;
int pin8 = 8;
int pokemonvalue = 0;
void setup() {
lcd.begin(16, 2);
pinMode(pin8, INPUT);
pinMode(pin9, OUTPUT);
lcd.print("Pokedex V 0.1");
delay(3000);
lcd.clear();
digitalWrite (pin9, HIGH);
}
void loop() {
if (pin8 = HIGH) {
lcd.clear();
// This is where I wanted to clear the display if pin 8 gets pulled high and show the next or previous case.
// but I couldn't figure out the function
}
}
lcd.scrollDisplayLeft();
delay (400);
switch (pokemonvalue) {
case 0:
lcd.setCursor(2, 0);
lcd.print ("Na:Bulbasaur No:001");
lcd.setCursor(2, 1);
lcd.print ("TypeA:Grass TypeB:Poison");
break;
case 2:
lcd.setCursor(2, 0);
lcd.print ("Na:Ivysaur No:002");
lcd.setCursor(2, 1);
lcd.print ("TypeA:Grass TypeB:Poison");
case 3:
lcd.print ("Venusaur ");
break;
case 4:
lcd.print ("");
break;
case 5:
lcd.print ("");
break;
case 6:
lcd.print ("");
break;
case 7:
lcd.print ("");
break;
case 8:
lcd.print ("");
break;
case 9:
lcd.print ("");
break;
case 10:
lcd.print ("");
break;
}
}