Posted by Centurian on 29/07/2017 07:05:01:
Select Mode, Mode = Step. If I press Select nothing happens. Pressing Left scrolls through the Modes. Pressing Up also scrolls through the modes and Down Scrolls through the modes in the reverse direction. Pressing the "Right" button does nothing. Pressing reset does a reset and also switches off the run light on the stepper driver module.
Does any one have a clue what I'm doing wrong? I have been very careful in my wiring and anyway I have tried it with just the Arduino Uno and display shield.
Hi Centurion,
This sounds like a well known problem that was discussed earlier on this thread. See my post on Page 4 and John Swift on page 8.
Those buttons are not individual switches. Instead, they cause a voltage change when pressed. The Arduino measures the voltage and decides which button has been pushed. Your problem is probably down to a small difference between the various versions of the Display Board. (Apart from there being a Mk1 and a Mk2, there are plenty of clones.) To fix it all you have to do is alter a few numbers in the Arduino Sketch to match your particular display board.
The code is the six 'if (Key_in … )' statements right at the end of Gary's sketch. It looks like this:
int read_LCD_button() // routine to read the LCD's buttons
{
int key_in;
delay(ADSettleTime); // wait to settle
key_in = analogRead(0); // read ADC once
delay(ADSettleTime); // wait to settle
// average values for my board were: 0, 144, 324, 505, 742
// add approx 100 to those values to set range
if (key_in > 850) return NO_KEY;
if (key_in < 70) return RIGHT_KEY;
if (key_in < 250) return UP_KEY;
if (key_in < 450) return DOWN_KEY;
if (key_in < 650) return LEFT_KEY;
if (key_in < 850) return SELECT_KEY;
}
Note Gary Liming's comment
// average values for my board were: 0, 144, 324, 505, 742
// add approx 100 to those values to set range
In the example above are the key_in values I used. (850, 70, 250, 450, 650, 850) You might try those values first.
If that fails, download this sketch and temporarily install it instead of Gary's program. All the sketch does is display the actual number generated by your keys. Write them down, then change the key_in values in Gary's sketch as per his +100 comment and re-install it.
With luck all should now be well.
Dave