Clay Dowling's Occasional Musings

I write code, build things, and occasionally lead teams. I also share my thoughts or things I've learned about them, so that others can learn from my mistakes.

Reading Buttons with GPIO

One of the better things to do with a GPIO bus is read inputs. The Raspberry PI can only read digital inputs directly, i.e. on or off. Conveniently, that's also the modes of a momentary switch.

There aren't any new gpio functions here. The biggest difference is that we're setting one of our pins (pin 22 in this case) to be an input.

The setup for reading buttons

→ Read more...

2016/02/09 13:13 · clay

Blinking lights with GPIO

In my last post we looked at a basic query of the GPIO bus just to show that we could read it. This time I want to actually control something. Blinking a light is the IoT equivalent of Hello World, so we'll try that. In this setup, the anode (short lead) of the LED is connected to pin 19 by a smaller resistor, and the cathode (long lead) is connected to the 3v ground bar.

→ Read more...

2016/02/08 21:24 · clay

C++11 Array Iteration

I've just gotten to play with the C++11 for extensions for the first time. It's really cool, especially the ability to iterate over a plain old array. Dig this code from my current hobby project:

→ Read more...

2016/01/29 22:22 · clay

Programming the GPIO on a Raspberry Pi

If you read my previous piece on putting FreeBSD on a Raspberry Pi, you're probably now wondering what exactly you're going to do with this little box. Fortunately I have invested the effort to work out some basics of handling GPIO on FreeBSD and a Raspberry Pi. Because of why I chose FreeBSD, I've also implemented it in C: my first choice for tackling new problems in systems programming.

→ Read more...

2016/01/27 19:17 · clay

FreeBSD on a Raspberry PI

Over lunch a colleague mentioned that she wanted to start using Raspberry PI projects to draw crowds at some of our community open house events. Because I first learned systems programming on FreeBSD, I wanted to try making it work. Fortunately there's a great little project called crochet that helps you build an image you can burn onto an SD card. Since cross compiling is actually kind of hard to set up, whenever it encounters a problem it tells you how to fix it.

If you're looking for the quick solution, download this pre-built image and burn it to an 8GB SD card.

→ Read more...

2016/01/10 20:35 · clay