What about this one?
/* Binary counting using 12 LEDs and a keypad to change
the increasing or decreasing rate */
#include <Keypad.h>
int i;
int x;
int ledPin[12]={13,12,11,10,9,8,7,6,5,4,3,2};
int counter;
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
/* I want to use i-- and i++ to either increase
or decrease the binary counting */
byte rowPins[ROWS] = {31, 33, 35, 37}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {39, 41, 43}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(){
Serial.begin(9600);
for(i=0; i<12; i++){
pinMode(ledPin[i], OUTPUT); // sets the digital pins as output
}
void loop(){
char key = keypad.getKey();
if (key=='1')
{
/* getKey for case A and case B
case A = increment
case B = decrement
*/
}
else if(key=='2')
{
}
else if(key=='3')
{
}
else if(key=='4')
{
}
else if(key=='5')
{
}
else if(key=='6')
{
}
else if(key=='7')
{
}
else if(key=='8')
{
}
else if(key=='9')
{
}
else if(key=='0')
{
}
}
Hope it looks better although it still has errors.
Now I have to figure out how to do the counting