talkative, friendly, programmer

Simple Piglow Snap for Raspberry Pi 2

Using a Raspberry Pi 2 with Ubuntu Snappy installed we’re going to write a
simple snap that will flash a piglow attached to the gpio pins.

If you want to skip these steps you can download the snap itself from here

1. A simple piglow flashing binary

To make things simple we’ll use go to produce a simple binary that will
flash the legs of the piglow. We’re using go because the static compilation means
our snap will have no dependencies to deal with. The code itself is small.
https://github.com/mattyw/flasher
I modified the piglow library I was using to get a bit more feedback about piglow
errors, the change is trivial to revert should you need to.

2. Create the snap

The package structure is simple

12345

├── bin
│ └── flasher
└── meta
├── package.yaml
└── readme.md

flasher is the binary I produced in step 1. The package.yaml just contains
information about the snap:

12345

name:hello-piglowversion:1.0.0vendor:mebinaries:-name:bin/flasher

Once you’ve got all this in place build it and send it over to your pi.