Code example: Using a TTP229 capacitative keypad with Espruino #1230
Unanswered
espruino-discuss2
asked this question in
Tutorials
Replies: 1 comment
-
Posted at 2020-05-02 by Robin Sat 2020.05.02 Thank you @colinp for the code snippet and pics. Had just seen a few of these recently and started imagining what uses might result. Hex calculator maybe? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Posted at 2020-05-02 by ColinP
Hello,
I had a TTP229 capacitative keypad module lying around and thought it would be useful with Espruino. These can be picked up fairly cheaply online. Just be careful: There are actually two variants of this chip and it isn't always clear which is which!
The modules I see on ebay seem to have the TTP229-BSF version of the chip - this is what mine is and what this code works with. I think if the module has "SCL" and "SDO" pins on it things should be OK. The other version has an I2C interface and won't work with this code.
To explain the code: You can treat the chip as though it has an SPI interface, and read out 2 bytes of data from it. These contain the keypresses, but inverted - ie '1' means not set, and '0' means set.
I hope the code below makes sense and is useful to somebody!
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions