wg0z:
The best way to check button_push for these DFROBOT shields is to call analogRead(A0)and range check the return value. never check for a single exact value, the divider resistances can vary board to board and with board agetry something LIKE this, youll need to experiment to find out the rough value the function returns
for a given buttonresult = analogRead(A0);
if (result >= 250)
; // no button is being pushed
else if (result >= 200)
UP;
else if ( result >= 170)
DOWN;
else if ( result >= 140);
LEFT;
else if (result >= 110);
RIGHT;
else
SELECT;
that's what he has with
int read_buttons() {
int adc_key_in = analogRead(0);
if (adc_key_in > 1000) return btnNONE;
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 195) return btnUP;
if (adc_key_in < 380) return btnDOWN;
if (adc_key_in < 555) return btnLEFT;
if (adc_key_in < 790) return btnSELECT;
}