Adafruit_RGB_LCD SHIELD FINITE STATE MACHINE PROJ

I've set everything back to the way it was when i started from my adafruit example.

I need to understand if I'm even able to use the Metro M3 Adafruit version Arduino Uno the same way you are using the R-Pi I have to look into that myself but I have no idea, if anyone knows let me know. Yes does also use the MCP23017 but I don't have the R-Pi only the Arduino. I need to research. I am trying to avoid the pain as this is purely hobby proj.

This is my example code I've commented out a bit because I'm trying to integrate a bit with your logic and attempted to do something with the Millis last weekend but am hitting myself up against the wall. Dan's asteroids and hunt the whumpus didn't teach me too well about state machine as I had hope which caused me to uninstall everything and start fresh.

/*********************

Example code for the Adafruit RGB Character LCD Shield and Library

This code displays text on the shield, and also reads the buttons on the keypad.
When a button is pressed, the backlight changes color.

**********************/

// include the library code:
#include <Wire.h>
#include <Adafruit_RGBLCDShield.h>
#include <utility/Adafruit_MCP23017.h>

// The shield uses the I2C SCL and SDA pins. On classic Arduinos
// this is Analog 4 and 5 so you can't use those for analogRead() anymore
// However, you can connect other I2C sensors to the I2C bus and share
// the I2C bus.
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

// These #defines make it easy to set the backlight color
#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define TEAL 0x6
#define BLUE 0x4
#define VIOLET 0x5
#define WHITE 0x7

//void setup() {
// Debugging output
// Serial.begin(9600);
// set up the LCD's number of columns and rows:
// lcd.begin(16, 2);

// Print a message to the LCD. We track how long it takes since
// this library has been optimized a bit and we're proud of it :slight_smile:
// int time = millis();
// lcd.print("Hello, world!");
// time = millis() - time;
// Serial.print("Took "); Serial.print(time); Serial.println(" ms");
// lcd.setBacklight(WHITE);
//}

void setup()
{
Serial.begin(9600);
Serial.println(F("\nStart"));
Wire.begin(); // start I2C library
lcd.begin(16,2); // initialize the LCD
lcd.setCursor(0, 0); // set the cursor to a specific position
lcd.print("Hello, world!");
lcd.setCursor(0, 1);
lcd.print("or something"); // show some special character entered in UTF-8

// for (auto & i : button)
// lcd.setPinMode(i, INPUT_PULLUP); // activate the internal pullups for the defined buttons
// lcd.setPinMode(rgbBlue, OUTPUT); // set the RGB pins to outputs
// lcd.setPinMode(rgbRed, OUTPUT);
// lcd.setPinMode(rgbGreen, OUTPUT);
// lcd.digitalWrite(rgbBlue, OFF); // swith a RGB pin
// lcd.digitalWrite(rgbRed, OFF);
// lcd.digitalWrite(rgbGreen, ON);
}

uint8_t i=0;
//void loop() {
// // set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
//lcd.setCursor(0, 1);
// print the number of seconds since reset:
// lcd.print(millis()/1000);

uint8_t buttons = lcd.readButtons();

if (buttons) {
lcd.clear();
lcd.setCursor(0,0);
if (buttons & BUTTON_UP) {
lcd.print("UP ");
lcd.setBacklight(RED);
}
if (buttons & BUTTON_DOWN) {
lcd.print("DOWN ");
lcd.setBacklight(RED);
}
if (buttons & BUTTON_LEFT) {
lcd.print("LEFT ");
lcd.setBacklight(RED);
}
if (buttons & BUTTON_RIGHT) {
lcd.print("RIGHT ");
lcd.setBacklight(RED);
}
if (buttons & BUTTON_SELECT) {
lcd.print("SELECT ");
lcd.setBacklight(RED);
}
}
}