Chris Crumpacker writes:
Another module of my alarm interface is done. I picked up a 3×4 matrix keypad from Adafruit (http://www.adafruit.com/products/419) But couldn’t find any good python code examples for it’s use. I was able to find a few examples that lead me down the right path in terms of scanning rows first as inputs and then swaping pins to scan the columns. I wrote two libraries, the first just uses 7 of the Raspberry Pi’s GPIO pins then I also wrote one that works for the MCP23008 chip since I’m really in a mode of saving pins when I can Then also just wrote a demo script to show calling the libraries and their use.
Here is the code as it stands now, I have some ideas on how to change it to be better but this is fully working for now.
Check out the blog post with source code here!
Featured Adafruit Products
Membrane 3×4 Matrix Keypad + extras – 3×4 – Punch in your secret key into this numeric matrix keypad. This keypad has 12 buttons, arranged in a telephone-line 3×4 grid. It’s made of a thin, flexible membrane material with an adhesive backing (just remove the paper) so you can attach it to nearly anything. (read more)
Each Friday is PiDay here at Adafruit, be sure to check out our posts, tutorials and new Raspberry Pi related products. Have you tried the new “Adafruit Raspberry Pi Educational Linux Distro”? It’s our tweaked distribution for teaching electronics using the Raspberry Pi. But wait, there’s more! Try our new Raspberry Pi WebIDE! The easiest way to learn programming on a Raspberry Pi.
We now have Raspberry Pi Model B with 512MB RAM in stock and shipping now!
Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.
Join us every Wednesday night at 8pm ET for Ask an Engineer!
Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground” – Adafruit’s Apps!
Maker Business — “Finally — some data on whether crowdfunding is a good investment or not”
Wearables — Sample code is your new best friend
Electronics — Meaningful gains
No comments yet.
Sorry, the comment form is closed at this time.