August 15, 2012
Tutorial - Elevator TARDIS
about 3 years ago
So I’m trying to mash in the WS 2801 code to get a light string to go when the ir code is received. Mind taking a look at my code to see what I’ve done wrong. I can’t get it to fire.
First I included this:
int SDI = 10; //Red wire (not the red 5V wire!)
int CKI = 11; //Green wire
int ledPin = 13; //On board LED
After Void Setup I include this:
//Clear out the array
for(int x = 0 ; x < STRIP_LENGTH ; x++)
strip_colors[x] = 0;
Then, just to see if it would work at all, I added the light line after the first mp3/IR check:
case 144: sprintf(trackName,“TRACK001.MP3”); break;
strip_colors = 0x0000FF; //Bright Blue
//post_frame(); //Push the current color frame to the strip
I also tried adding this to the end of the sketch, but it wouldn’t compile with it so I commented it out:
//Pull clock low to put strip into reset/post mode
delayMicroseconds(500); //Wait for 500us to go into reset
Obviously I’m just trying to get the fundamentals down–then I can start experimenting with fading and timing. The sketch compiles and uploads–but I get no love from the lights.
I’d love to know what I’m doing wrong if you’ve got a second.
Hi Mike -
Back again. I thought I had this but then I decided to use the WS2801 RGB LED strip instead of your blue LEDs. I’ve got them up and running and figured out some lighting and timing, but here’s where I could use a little help. I want different light effects to launch when the different IR codes are received (to pulse with the Tardis sound, or flash multi-color during the theme song. Again, I’m not having luck mashing up the https://www.sparkfun.com/products/11272 code into what we’ve cobbled together and I’m not sure how to include what I’m assuming is an if/then command to get the lights to go when the music starts and time it to end when the music does.
Does that make sense?
Thanks for any help.
Holy crap! It totally works!
So here’s where I might be running into a problem:
Your sketch requires this change to Bill Greiman’s sdfatlib:
“You will need to download and install his library. To compile, you MUST change Sd2PinMap.h of the SDfatlib! The default SS_PIN = 10;. You must change this line under the ATmega328/Arduino area of code to uint8_t const SS_PIN = 9;. This will cause the sdfatlib to use pin 9 as the ‘chip select’ for the microSD card on pin 9 of the Arduino so that the layout of the shield works.”
But Sd2PinMap.h doesn’t exist in the current library.
The mp3 controller sketch suggests a workaround involving adding “,9” to this line:
if (!card.init(SPI_FULL_SPEED,9)) Serial.println(“Error: Card init”); //Initialize the SD card and configure the I/O pins.
Does that make sense to you? Or would it be better if I found and used an older version of the library?
1 other little thing–when I was compiling , it told me to change wire.send to wire.write and wire.receive to wire.read. It compiled fine after that. I did a little research and it shouldn’t seem to matter, but I just wanted to double-check with you.
This looks awesome, Mike. We’ll try it out as soon as we can, but I wanted to say thanks ASAP.
I’m trying to adapt this hardware/software design to make a door painted like the Tardis in my son’s room do a few things and I’m close, but need a bit of help with 2 things:
Instead of the accelerometer, I want to use the sparkfun IR control kit to trigger 1 of 4 different mp3s (all DR Who, of course). I’m not quite sure how to swap out the accelerometer code in the sketch and where to put in the IR code. Also not sure how to tweak the sketch to play more than 1 mp3 file.
Any advice would be appreciated. I’m pretty good with the hardware side of things, but sometimes the programming (especially mashing up different codes) goes a bit over my head. Thanks in advance.
about 3 years ago
Hi-Making some progress but still could use a little help, please. Here’s my serial report:
SCI_Mode (0x4800) = 0x4800
SCI_Status (0x48) = 0x48
VS Version (VS1053 is 4) = 4
SCI_ClockF = 0x0
SCI_ClockF = 0x6000
Start MP3 decoding
[Then a whole bunch of recurring “Time to replenish buffer” lines scream by.]
Also, the Arduino Uno light is flickering as if it’s doing something. Only problem is, I can’t hear anything. I’ve got a simple pair of headphones plugged into the jack.
I made this change, per the forums:
card.init(SPI_FULL_SPEED) to card.init(SPI_FULL_SPEED,9)
I feel like I’m so close, but what am I missing?
Having a little trouble I could use some help with. I’m confused that I can’t find this line to change in the current library
http://code.google.com/p/sdfatlib/: “To compile, you MUST change Sd2PinMap.h of the SDfatlib!”
I see madsci1016’s not about changing a single line in the sketch - is this what’s it’s supposed to look like?
And… am have I edited this line correctly:
//Let’s play a track of a given number
sprintf(trackName, “track001.mp3”, trackNumber); //Splice the new file number into this file name
playMP3(trackName); //Go play trackXXX.mp3
Hi. I just downloaded the sdfatlib dated July 19 and this line isn’t even in it to be fixed: …/arduino-0022/libraries/SdFat/Sd2PinMap.h
I’ve got the mp3 shield on the program uploaded. But it’s not going to work if I can’t change that line, right? And I can’t change that line if it doesn’t exist, right?
So… what do I do?
No public wish lists :(
Forgot your password?
No account? Register one!