Posts Tagged ‘WaveShield’
Friday Night Robotics – MusicBox!
This Friday I had the most awesome idea of a weekend project ever! A 21st century MusicBox, using an Arduino and have blinking LEDs!
I had a Sparkfun box lying around, which is an ideal size for an Arduino and a WaveShield.

I wanted to have LEDs outlining the box, so I went to work on it:


Just as a disclaimer- I designed it wrong, so the LEDs don’t work well. If you’re looking to follow my steps, DON’T DO IT!


Then, installing them into the box:

It looks nice!

Once all of the connections are made, it’s pretty tight in there:

The problem though, is that I designed it so that all the LEDs are in series. Since al LEDs aren’t created equally, some suck up more power and therefore can’t share it with the others. This is what happened:

It’s pretty sad!
But, I think that I can fix it because I soldered the resistors together, not the actual LEDs together.
I was too excited to start this project, so I didn’t bother to plan =) I guess planning would have been better, but it would also have been too boring.
I also worked on a NXT LED blinky thingy. There are these HiTechnic Protoboards that you can get, and basically you attach them to one of the sensor inputs, and you can control power to certain ports and such.
In this case, there’s 6 output pins that you can control. Sounds like an opportunity to use LEDs to me!

This is what the setup looks like:

It goes like this: NXT -> HiTechnic ProtoBoard Sensor Adapter -> 6 LEDs
In order to output instructions to the HiTechnic ProtoBoard, you need ‘drivers’, or headers. They’re located here.
Here is the code for the LEDs, in RobotC:
-
#pragma config(Sensor, S1, HTPB, sensorI2CCustom9V)
-
//*!!Code automatically generated by ‘ROBOTC’ configuration wizard !!*//
-
-
/*
-
Crazy LEDs!
-
Erin K
-
Oct. 9th, 2009
-
*/
-
-
#include "drivers/common.h"
-
#include "drivers/HTPB-driver.h"
-
-
byte theLEDs[] = { 0×01, 0×02, 0×04, 0×08, 0×10, 0×20 };
-
-
task main() {
-
-
// Setup all the digital IO ports as outputs (0xFF)
-
if (!HTPBsetupIO(HTPB, 0xFF)) StopAllTasks();
-
wait1Msec(200);
-
-
while(true) {
-
-
// The delay time
-
int theTime = 50;
-
-
// LEDs going up
-
for(int i=0; i<6; i++) {
-
if (!HTPBwriteIO(HTPB, theLEDs[i])) nxtDisplayTextLine(5, "ERR WRITE");
-
wait1Msec(theTime);
-
}
-
-
// LEDs going down
-
for(int i=5; i>=0; i–) {
-
if (!HTPBwriteIO(HTPB, theLEDs[i])) nxtDisplayTextLine(5, "ERR WRITE");
-
wait1Msec(theTime);
-
}
-
-
alive();
-
-
}
-
-
}
This is what the code does:
To wrap up this Friday Night Robotics, I checked out the Adafruit Ask an Engineer chat. It was pretty cool! I learnt about how LEDs work, and how much it costs to create a Teenyduino! Everyone should check it out, Saturday at 10:00PM EST.
The only things that I didn’t get to do that I wanted to was play with MANOI and the iRobot Create. I’m kinda worried that MANOI’s batteries are drying out as they haven’t been exercised in a while :S EEP!
