There are numerous python libraries out there for the 16 port MCP23017 GPIO expander chip that works with the Raspberry Pi, so why yet another one? None of the ones I could find actually implement interrupts via the chip Polling is not ideal for my home monitoring setup. I was already monitoring via interrupts and the onboard GPIO pins using the awesome RPIO module and wanted to continue using interrupts with the expansion chip. So I built my own module, leveraging Adafruit’s I2C library for the nitty gritty backend interface.
- Simple digital input and output via all pins
- Input interrupts
- Interrupt port mirroring is configurable – either INTA and INTB can trigger independently for their respective GPIO port banks, or both INTA and INTB can trigger at the same time regardless of what GPIO pin causes the interrupt
- Configurable interrupt polarity – INT could pull the pin high or push it low
- Each GPIO pin can be configured for interrupts independently to either compare against the previous value or against a default pin value
- A utility method cleanupInterrupts that can be called periodically to clear the interrupt if it somehow gets stuck on
You can find the library on my BitBucket.
Stick around after the break for a breakdown of how to use it.
Continue reading MCP23017 GPIO Expander python 3 Library – With Interrupts!
At last! The third and final part of our git series has arrived. The first two parts of the series get you started with git and interacting with your project. They are available here:
Git part 1: Intro to git, setup a git server on CentOS and create a new project
Git part 2: Interacting with your project
In the final chapter of this series, we’ll explore a few of the more advanced features.
Continue reading Git part 3: Branching, merging and resolving conflicts
Sometimes in a coding project there will be files or directories that should not be included in a git repository. Common examples are temporary folders, log files, or files containing passwords/keys that should be regenerated by each installation of the software and kept secret. Fortunately, it is very easy to ignore these files when committing the git project.
Continue reading Git Quick Tip – Ignoring a file
The asset pipeline is great and confusing at the same time. It performs differently in development than it does in production, and as such you can’t be really sure everything is going to work once you deploy it, unless you really understand it, of course.
Continue reading Rails Asset Pipeline When Application is Deployed in a Subdirectory
One of my gripes (or possibly misunderstandings) with Rails is that you have to make the schema within Rails. I find that difficult – I want to plan it externally, create the schema, and then use it in my app. Perhaps there is an easier way to accomplish that, but here’s what I do.
Continue reading Rails – dump an existing database schema so it can be rebuilt easily
OK, before you go yell at me, I know enabling detailed error messages on a production web application is a Bad Thing™. The security guy in me hates finding a production application that spews back all kinds of details to a user when something goes wrong, and I’ve had many a developer disable detailed error messages on their production applications.
Continue reading Rails Quick Tip: Show Detailed Errors in Production
In part 1, we set up a git server and created a blank project. Now let’s write some code on our development box and commit it to our git repo.
Continue reading Git part 2: interacting with your project
From git-scm.com: “Git is distributed version control system focused on speed, effectivity and real-world usability on large projects.” It is the new subversion. Every coder seems to be using it and every coder seems be loving it. I’ve only scratched the surface with it and can already see how it will help me manage development on my current project.
Continue reading Git part 1: Intro to git, setup a git server on CentOS and create a new project
Like PHP or any other web programming language, you can deploy multiple instances of the same Rails application on the same server. One reason for having multiple instances on the same server would be the need for multiple exclusive data sets while saving costs on hardware and administration from having to maintain multiple boxes. All you need to do is duplicate the application files, change your database configuration in each directory, and configuring some virtualhost settings.
Continue reading Separate session per URI under Rails 3.1 and Phusion Passenger