While I wait for LJ to let me log in again (to upload photos), or until I find a better alternative, I thought I'd share some more of the LED-matrix top code with you.

Here's version 2, with the SparkFun wearable keypad functionality added. Let me know if there's any problems, or if you'd simply like to discuss it.

(Version 1 post)
◾ Tags:
I received a request for clarify some of the code I use in the LED-matrix top, so I've decided to start sharing my code in a more modern way. But before we get to that, if you are thinking of following my adventures in making this top there are a couple of things I want to add.

  1. Please please please use metal snaps instead of metal rings!

  2. Use lithium-ion batteries, more power, much better.

  3. As soon as you have the circuit working as you want, cover each conductive trace with fray-stop glue to prevent oxidation of the conductive coating over time.

  4. Test that you can turn on each LED individually by using a (at least 3V) coin-cell battery and touching the positive side to the trace that connects to the positive side of the LED, and the negative to the negative. If it doesn't light up get a multimeter and check every single trace/LED for short-circuits.

Okay, so the top is physically made up and working fine? Great! Here's the first version of the code, with the LEDs working, and the push-button switch for cycling through patterns, and that's it. It's available through github at https://github.com/chebe/chebe-led-matrix-top. I'll let you know as I clean up and release newer versions.
◾ Tags:
I admit I can be a bit of a sucker when it comes to electro-textile stuff. I see the word 'wearable' in front of any traditional electronic component and I have to investigate. Which is how I came to possess the Wearable Keypad from SparkFun. I finally got around to using it recently, so here's the low-down.

It's a thick piece of rubber, glued together and sealed with silicon gel type stuff. It has six wires (about a metre long) coming from it. One wire is not connected (NC), one is ground (GND), one is for setting the brightness of the red LEDs behind the keypad (LEDR), and the other three (p5.1, p5.2, p5.3) are for the button presses. And as mentioned in the comments (of the product page) the order of the wires is backwards to that as shown in the datasheet.

Wait, you say, three wires for five buttons? What's going on? Seems to be a bit of fancy multiplexing, although the details are beyond me. I have however, managed to get it all to work for me, and have edited the Example Code provided by SparkFun to, shall we say, neaten up things a bit? Basically, I found that in the provided code I was getting spurious results; when I'd press 'down' I'd often get a 'left' or 'right' for no apparent reason. So I've added a few extra checks, that while they may slow the code down a bit, ensure clean detection of button presses. All the extra stuff to do with the LEDs I've stripped out. You may not need it, but here it is in case you do. (Also, your millage may vary, and as such you may need to edit this code to work just right for you.)

But give the SparkFun example code a go too. It's oddly satisfying to play with the LEDs.

Let's go )

I have to say though, I was a bit surprised that the keypad came with such long wires, and unfinished ones at that. While it works well with an Arduino Uno, it doesn't do so well with the Arduino Lilypad. I'm going to have to come up with a suitable interface to get the two to play well together. (And yes, this is part of a larger project...)
◾ Tags:
Someone asked me for this and I realised I'd never posted it. (I had dealt with reading the temp here but not the rest of it.) It's not fully done. The timing and lights and such could still do with some tweaking, but I guess that comes down to personalisation. If you'd like to try this project the physical construction is here, and what follows is my code. If you do give it a go I'd love to see how it turns out!

code monkey like you )