Ok so I'd need to figure a way to split the variable across 2 "lines". Here's my entire code:
// unused Arduino pin: 6,14-18 (A0-A4) (AVR 12, 23-27)
#include <LiquidCrystal.h>
int LCDLED = 13; // backlight LED pin AVR 18
int buttonup = 2; // pin to connect the UP button AVR 4
int buttondn = 3; // pin to connect the DOWN button AVR 5
int presses = 0; // variable to store number of presses
long dtime = 0; // used for 'since last press'
long debounce = 200; // how many ms to "debounce"
long idletime = 15000; // about 15 seconds for display idle before turning off LED
const byte numPins = 5; // just 5 pins (4 pins to 75154, 5th to enable for either second '154 or '138
int state; // used for HIGH or LOW
byte pins[] = {19, 0, 1, 4, 5}; // pins to connect to 74154 AVR 28, 2, 3, 6, 11
const int rs = 7, en = 8, d4 = 9, d5 = 10, d6 = 11, d7 = 12; // AVR 19, 23, 24, 25, 26, 27
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
char* gameSys[] = {" Atari 5200 ",
" Atari 7800 ",
" Intellivision ",
" Colecovision ",
" Nintendo ",
" Super Nintendo ",
" Nintendo 64 ",
" Gamecube ",
" Genesis CD 32X ",
" Sega Saturn ",
" Dreamcast ",
" Turbo Duo ",
" Playstation ",
" Platstation 2 ",
" Sony PSP ", // portable system via AV cable + Bluetooth PS3 controller
" ---1 ",
" ---2 ",
" ---3 ",
" ---4 ",
" ---5 ",
" ---6 ",
" ---7 ",
" ---8 ",
" ---9 ",
" ---10 ",
" ---11 ",
" ---12 ",
" ---13 ",
" ---14 ",
" ---15 ",
" ---16 ",
" End of line ",
};
void setup()
{
for (int i = 0; i < numPins; i++) { // setting the 5 pins to 74154 + 74137 or second 74154
pinMode(pins[i], OUTPUT);
digitalWrite (pins[i], LOW);
}
pinMode(buttonup, INPUT); //setting both buttons
pinMode(buttondn, INPUT);
digitalWrite(buttonup, HIGH); // internal pullup
digitalWrite(buttondn, HIGH);
attachInterrupt(0, countdn, LOW); // attaching interrupt to 2 separate loops
attachInterrupt(1, countup, LOW);
pinMode(LCDLED, OUTPUT); // for LED on LCD panel
digitalWrite(LCDLED, HIGH); // turn on LED backlight
lcd.begin(8, 2); // using 16x1 display that is mapped like 8x2
lcd.setCursor(0, 0); // reset LCD cursor
lcd.print(gameSys[0]); // prints starting display
}
void loop()
{
String binNumber = String(presses, BIN);
if ((0 <= presses) && (presses <= 31)) { // set the 5 pins output according to current button setting
digitalWrite(pins[0], (presses & B1));// using bitmask to select the correct bit to write to pin
digitalWrite(pins[1], (presses & B10));
digitalWrite(pins[2], (presses & B100));
digitalWrite(pins[3], (presses & B1000));
digitalWrite(pins[4], (presses & B10000));
} else {
if (presses > 31) presses = 0;
if (presses < 0) presses = 31;
}
if (millis() - dtime > idletime) {
digitalWrite(LCDLED, LOW); // turn off backlight, switch hasn't been used for a while
lcd.setCursor(0, 0); // reset LCD cursor
lcd.print(" "); // erase display
}
}
void countup() { // up button
if (millis() - dtime > debounce) presses++; // increment presses
digitalWrite(LCDLED, HIGH); // turn on LCD backlight, a button was pressed
lcd.setCursor(0, 0); // reset LCD cursor
lcd.print(gameSys[presses]); // prints current display according to variable in gamesys[]
dtime = millis(); // reset last pressed
}
void countdn() { // down button
if (millis() - dtime > debounce) presses--; // decrement presses
digitalWrite(LCDLED, HIGH); // turn on LCD backlight, a button was pressed
lcd.setCursor(0, 0); // reset LCD cursor
lcd.print(gameSys[presses]); // prints current display according to variable in gamesys[]
dtime = millis(); // reset last pressed
}
lcd.print on 0,0 works for the first 8 characters, how would I put the second 8 characters from inside gameSys[presses] so it'd appear on 0,1? I tried -7,1 but that doesn't seem to work, 0,32 does work but it just seems a little messy if there's a way to take only the right 8 characters and stick them in 0,1