Iterate through UniPi1 digital IN/OUTs
-
Hi,
I want to operate a 4x4 switch matrix with the UniPi1
digital IN/OUT 1-4: matrix rows 1-4
digital IN/OUT 5-8: matrix columns 1-4I want to iterate now through the digital_IO 1-4, so to check the switch status of each row by reading digital_IO 5-8.
My simple question is: how to code this in ST??
I mean, how to call the unipi digital_IO using a variable?Thanks a lot for support!
-
Hi @ckb,
this is not possible, since digital inputs are only inputs, not outputs. For scanning switch matrix, you need to apply voltage to each column separately, and then read rows (or vice versa). Theoretically it can be done with relay outputs (4 ROs to columns, 4 DIs to rows), but relays are really not the right components for this type of application.If you know a bit of electronics, try looking into this: https://www.eleccircuit.com/16-key-encoder-using-ic-74c922n/
Reading the BCD code in FBD or ST is a piece of cake.
Best regards,
Martin -
Thanks for reply and for the link!
I assumed the digital INs could also act as OUTs.. pitty.. :/Do you know if there's any product that I can buy of the shelve or a product that uses the I2C? It's just a time issue...
-
I found a capacitive keypad here: https://www.robotshop.com/uk/16-button-capacitive-keypad-module.html
and a module that can connect the keypad via I2C here: https://www.robotshop.com/uk/16-keys-capacitive-touch-ttp229-i2c-module.htmlBefore I buy it - can UniPi1 cope with this?
Thanks
CB -
It can be theoretically connected to the UniPi 1.1, you will not get it working directly in the Mervis. Mervis doesn't have any support for custom I2C devices. You would have to write some I2C - Modbus bridge in Python for example.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login