Most recent activity
-
- 6 comments
- 305 views
-
-
Sorry about posting there as well and since it is closed, progress here.
Firmware was originally 2v17.118_esp32 but updated now to latest 2v17.120_esp32.
Your tip about use of
for (var i in rows) {
loops was very relevant and changing them tofor (var i of rows){
andfor (var i=0;i<rows.length;i++) {
loops fixed the return values for keypad.read() so that's all good now.The callback version is still a problem although there was some progress after fixing those loops, since pinMode() and setWatch() were being fed with strings rather than numbers. With some added
print()
s I can see them being set up correctly now. However the onWatch() callback is still never executed.I tested the same pins separately with a mechanical switch e.g.
var onWatch = function() { print("XXX"); }; pinMode(D22, "input_pulldown"); setWatch(onWatch, D22, {repeat:true, edge:'both' });
and it works fine for all the pins being used for the keypad. Nevertheless, still no luck with the keypad itself.
More digging needed and any help appreciated ...
-
I'm trying to use the keypad module without success. The recommended:
require("KeyPad").connect([B2,B3,B4,B5],[B6,B7,B8,B9], function(e) { print("123A456B789C*0#D"[e]); });
is never called back.
I also tried
var keypad = require("KeyPad").connect([B2,B3,B4,B5],[B6,B7,B8,B9]);
and printed output of
keypad.read()
in a while loop. This produced output like 38 28 08 312 212 012 etc. depending on the key pressed.I tested the same keypad using the same pin connections on the same device in an arduino sketch where it worked perfectly.
Anyway, since there was at least some output, I was going to start hacking on the source code but in the meantime, is anyone using a keypad successfully?
Thanks for any pointers ...
-
-
- 1 comment
- 158 views
Could the problem have something to do with the keypad type? I ran the following code:
where the first 3 pins are connected to column outputs of 4x3 membrane type keypad and last pin is connected to a single mechanical switch. The first three watches never trigger a callback whereas the last one always triggers the callback.
I separately tried the mechanical switch on all of three pins used above for the 4x3 keypad columns and the mechanical switch triggered the callback every time.
This all leads me to suspect something about the keypad itself. It's the same style as the first shown in the Espruino KeyPad Matrix page. I've tried both a 4x4 and a 4x3, both of which work using the plain
keypad.read()
yet don't seem watchable.