Using your keypad, you can give code below (as well attached) a shot. In your case, the use of pins for driving and sensing a 3x2 = max 6 buttons and using only 4 of the 6 options while consuming 5 GPIO pins is not the most effective use of anyway already sparce resources... to say the least. You may consider an SPI or I2C driven port extender that uses max 3 GPIO pins for 8, 16, 24, 32,... estended pins...
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Using your keypad, you can give code below (as well attached) a shot. In your case, the use of pins for driving and sensing a 3x2 = max 6 buttons and using only 4 of the 6 options while consuming 5 GPIO pins is not the most effective use of anyway already sparce resources... to say the least. You may consider an SPI or I2C driven port extender that uses max 3 GPIO pins for 8, 16, 24, 32,... estended pins...
1 Attachment