I can’t believe how the sands of time manage to slip so quickly between my fingers. It's not my fault; it's just that so many things have been happening recently.
The problem is that, while I've been running around, others have been making strides in our Capriciously Cunning Chronograph Competition. Take the Contemptible Cowie, who has an office in the bay next to mine, for example. This little scamp (the clock, not the Cringing Cowie) now boasts a real-time operating system and some very tasty lighting effects. This little rascal (the Cowering Cowie, not the clock) already has the ability to talk to his chronograph. I can also talk to mine, of course; the difference being that his actually pays attention and responds to what he's saying.
And, just today, I heard from my chum Steve Manley in England that he's been making a lot of progress with his implementation, that he is currently uploading a video, and that he will be sending me a detailed set of construction details (I'll be posting a column showing all of Steve's stuff in the very near future).
All of this activity has spurred me into action. Feast your orbs on this video, which shows the current state of play with regard to my own humble attempt.
This is just a very simple test jig I threw together with a piece of hardboard that I spray-painted black and mounted to a chunk of plywood (a hot glue gun really is one's best friend). Actually getting this to work took a lot longer than you might expect, but this was my fault as we shall discover.
As an aside, here's a picture of my kitchen table just before I commenced work on the clock. The various tools and bits and pieces are left over from a previous project.
What project? Well, I'm teaching electronics and microcomputers to a young lad called Jacob -- his grandmother runs him down to my office for an hour's instruction once a week. As you can imagine, Jacob loves my BADASS Display. When he heard this, my chum Duane Benson was kind enough to send Jacob one of the PCBs he'd created for the spectrum analyzer shield in the display.
As fate would have it, I had enough spare parts on hand to populate this shield (I always order extras), so on Jacob's last visit we populated the card and soldered everything together -- apart from the two 8-pin MSGEQ7 chips, which we are socketing -- and we were all ready to rock and roll... except that we'd run out of time.
Actually, this entire process was very cunningly timed, because the next step is for Jacob to use his multimeter to check that all of the voltages are as we expect. Then we'll insert the MSGEQ7 chips, plug in an audio source, and use the spectrum analyzer to drive two LEDs. Finally, we'll move up to creating a mini-BADASS display using six NeoPixel strips (each boasting five pixels) that we'll use to display the base, middle, and treble for the left and right channels.
The thing is that I know how disappointing it can be when you are younger and things don’t work as expected (I can teach him about the pain joy of debugging stuff later), so I took everything home and checked it out myself this past weekend. I then removed the MSGEQ7 chips again so that Jacob can have the pleasure of testing the board and inserting them himself (using full anti-static protection, of course).
Last but not least, it turns out that Jacob listens to all his music using earbuds plugged into his iPhone, so the first thing we needed was an amplifier and some speakers with a 3.5mm stereo jack input. Fortunately, there's a technology recycling center just round the corner from my office, so I was able to pick up some cool-looking amplified speakers and a wall-wart power supply, all for under $10. Jacob is going to be a very happy camper on his next visit.
But we digress... For the purposes of our Capriciously Cunning Chronograph Competition, we're all using three concentric NeoPixel rings. The inner ring has 12 elements; the middle ring has 24 elements, and the outer ring has 60 elements. It's up to each contestant to decide how to best use these rings to reflect the current time (speaking of which, there's still time for you to join in the competition).
The 12- and 24-element rings come pre-assembled, but the 60-element ring comes as four quadrants that have to be soldered together. So I assembled the 60-element ring, attached power, ground, and signal wires to each ring, and then mounted all three rings on my jig. I then cut the wires short on the back, connected everything together, created a simple test program, powered things up... and nothing happened whatsoever.
Well, that's not strictly true. I did get one element to light up on the 60-element ring, but that was it. After a little pondering, I tracked down the first problem. I'd written something like the following, which I originally intended to display a single pixel racing round the ring:
for (i = 0, i < 60; i++) {
ring60.setPixelColor(i,255,255,255);
if (i == 0)
ring60.setPixelColor(59,0,0,0);
else
ring60.setPixelColor(i-1,0,0,0);
}
delay(20);
ring60.show();
I'd also created similar code snippets for the 24- and 12-element rings. Can you see the problem? The delay() and the show() commands are outside of the main loop, so it's not surprising that I will only ever end up with a single LED lit. The solution was to re-write this snippet as follows:
for (i = 0, i < 60; i++) {
ring60.setPixelColor(i,255,255,255);
if (i == 0)
ring60.setPixelColor(59,0,0,0);
else
ring60.setPixelColor(i-1,0,0,0);
delay(20);
ring60.show();
}
Following this change, the 60-element ring worked for the first three of its four segments, but the remaining segment remained dark. Furthermore, the 24- and 12-element rings remained totally unresponsive. That's what you get for using "cut-and-paste" -- I'd forgotten to change the ring60.show() command to ring24.show() and ring12.show() commands in the other two loops. Following a quick tweak, we soon had those up and running.
All that remained was the fourth segment of the 60-element ring. It was obvious that I'd either messed up a power, ground, or signal connection -- or that the segment itself was dead -- but the only way to sort this out was to dismantle the jig again.
This was the point where I started to kick myself (I still have the bruises). Why on earth hadn’t I tested all of the rings before mounting them on the jig? I think I'd just become a little too blasé -- I won’t make that mistake again.
Thus, I had to cut all of my wires and strip everything down. Dang! There was a tiny little solder spur shorting the control signal to ground. In just a few seconds everything was working as planned, so I reassembled the jig and whipped up a little program to race a pixel around all three LEDs in synchronization as illustrated in the video we looked at earlier.
On the off-chance you are interested in seeing the code for this, just post a comment below and I'll make it available. Meanwhile, I'm poised to start creating a capriciously cunning power-up sequence. Watch this space...
文章评论(0条评论)
登录后参与讨论