iuint8_t LiquidCrystal::readButtons(void) { int adc_key_in = analogRead(0); // read the value from the sensor // my buttons when read are centered at these valies: 0, 144, 329, 504, 741 // we add approx 50 to those values and check to see if we are close if (adc_key_in > 1000) return 0x00; if (adc_key_in < 50) return BUTTON_RIGHT; if (adc_key_in < 195) return BUTTON_UP; if (adc_key_in < 380) return BUTTON_DOWN; if (adc_key_in < 555) return BUTTON_LEFT; if (adc_key_in < 790) return BUTTON_SELECT; return 0x1F; // when all others fail, return this… }