Go Down

Topic: i2c keypad and setHoldTime (Read 781 times) previous topic - next topic

enterpc

how can i insert Hold Time on i2c keypad it isn't included in i2c keypad library can i use it ?

UKHeliBob

Please post your code so that we can see what you have done so far.
A link to the library you are using would also help.

Can you please explain what you want to do in the context of your code ?
It sounds like you want to set the time a key must be held before it is recognised but without a fuller explanation it is impossible to know.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

enterpc

this is my code
Code: [Select]


UKHeliBob

Assuming that by setHoldTime is used to set the time that a key is held before it is recognised then the library does not seem to have such a method.  You could consider modifying the library to include such a method (or a fixed time) but can you please confirm the meaning of setHoldTime and why it is important to you ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

enterpc

because when i press a button i take 3 times this button for example when i press the 3 i take 33333

UKHeliBob

If you press the button (key) 3 times I would expect to only get 3 values.

Does the get_key method return a value :
(a) When a key is pressed
or
(b) when a key is released
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

enterpc


UKHeliBob


When a key is pressed

Have you tried applying debouncing code to the reply from get_key ?
Read the keypad.  Start a timer.  When the timer finishes read it again.  If it is the same accept the key, if not, do it again until the 2 readings match.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

mstanley


how can i insert Hold Time on i2c keypad it isn't included in i2c keypad library can i use it ?
If you are using G.D. Young's Keypad_I2C https://github.com/joeyoung/arduino_keypads/tree/master/Keypad_I2C library then the answer is yes.  His library inherits from the keypad library which provides a public function for setting the hold time.
Code: [Select]
setHoldTime(unsigned int time)
http://playground.arduino.cc/Code/Keypad#Functions

But his library requires that you are using an I2C port expander.  So if you are not using that, and/or you are using one of the other I2C keypads then this info will mean nothing to you.

Go Up