Hi, Folks:
I'm Arduino noob and still trying to figure out how's everything working.
I currently got a 4x4 keypad.
I wondered if it is possible to input delay time from keypad so I can control LED flashing time (on time = off time). Here's the code I came up with.
// #include <Keypad.h>
// const byte COLS = 4; //three columns
// const byte ROWS = 4; //four rows
// char keys[ROWS][COLS] =
// { {'1','2','3','A'},
// {'4','5','6','B'},
// {'7','8','9','C'},
// {'*','0','#','D'} };
// byte rowPins[ROWS] = {2, 3, 4, 5}; //connect to the column pinouts of the keypad
// byte colPins[COLS] = {6, 7, 8, 9}; //connect to the row pinouts of the keypad
// Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
// int LedPin=10;
// int Duration;
// void setup()
// { Serial.begin(9600);
// Serial.println("4x4 keypad");
// pinMode(LedPin, OUTPUT); }
// void loop()
// { char key = keypad.getKey();
// if (key)
// Duration = (key)*10;
// Serial.println(Duration-480);
// digitalWrite(LedPin, HIGH);
// delay(Duration);
// digitalWrite(LedPin, LOW);
// delay(Duration);
// }
Well........... Obviousely its not working. Orz.
Any idea how to fix this code please? Many thanks for the help.