I am a newbie on my third project, but I am having problems getting the inputs from a membrane ( which I have working ) to make a 7 segment display either increase its count each time one button is pressed, or decreased if the other button is pressed. It must only count up to 9 and then roll over to 0 again ( or 9 when it counts down to 0 )
I need to increase a counter, and then convert it with a lookup table to send serially to a HTC595 to light the correct segments. ( there are 4 such 7 segment displays , and 8 buttons of course )
I am calling one digit GT and have been playing first with getting it to increment when button F is pressed, which it does, but every other button also increments it.......
( The keypad sketch is from one of the examples in the Keypad library )
Once I get this working I still have to work out the lookup table for the serial out.
This is what I am playing with :-
int delay ();
byte rowPins[ROWS] = {7, 6, 5};
byte colPins[COLS] = {8, 9, 10, 11}; //connect to the column pinouts of the keypad
//initialize an instance of class NewKeypad
Keypad cusomKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup(){
Serial.begin(9600);
}
void loop(){
delay (100); // my crude debounce
char customKey = cusomKeypad.getKey();
if (customKey != NO_KEY){
Serial.println(customKey);
Serial.println(GT);
if (customKey ='F' ) { GT++ ;} }
if (GT==10) { GT=0;}
Serial.println(GT);
}
}