Just a forewarning, I am really new to Arduino, been tinkering with it for about a few months and successfully built sensor triggered audio output thanks to the ease of the WaveShield. I am using arduinos as the brains for many of my animated haloween features including several WaveShields to output custom audio along with the servo controls.
I am also an avid DMX (Theatre lighting protocol) user for my djing gigs, so I have aquired over the years a fairly large collection of dmx controllable lights and fixtures. I would like to incorporate them into the halloween features by controling them using the DMX Shield and the library DMXSimple.
I have successfully been able to get the DMX shield and DMXSimple Library to work properly, however the second I integrate this into my sketch that uses the WaveHC library, the arduino seems to halt/loop. I am using the simple daphc sketch for testing and just loading the DMXSimple library using #include <DmxSimple.h> (have not executed any DmxSimple class routines at this point either)
I've done some basic troubleshooting steps (basic serial outputs at certain stages) in the code to see where it is failing and it seems to stop working at the line of code marked "FAIL HERE":
When viewing the serial output, it is contantly looping this line putstring_nl("\nWave test!");
Code: Select all
#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include "WaveUtil.h"
#include "WaveHC.h"
#include <DmxSimple.h>
SdReader card; // This object holds the information for the card
FatVolume vol; // This holds the information for the partition on the card
FatReader root; // This holds the information for the filesystem on the card
uint8_t dirLevel; // indent level for file/dir names (for prettyprinting)
dir_t dirBuf; // buffer for directory reads
WaveHC wave; // This is the only wave (audio) object, since we will only play one at a time
// Function definitions (we define them here, but the code is below)
void lsR(FatReader &d);
void play(FatReader &dir);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps for debugging
putstring_nl("\nWave test!"); // say we woke up!
//putstring("Free RAM: "); // This can help with debugging, running out of RAM is bad
//Serial.println(freeRam());
// Set the output pins for the DAC control. This pins are defined in the library
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
// if (!card.init(true)) { //play with 4 MHz spi if 8MHz isn't working for you
if (!card.init()) { //play with 8 MHz spi (default faster!)
putstring_nl("Card init. failed!"); // Something went wrong, lets print out why
sdErrorCheck();
while(1); // then 'halt' - do nothing!
}
// enable optimize read - some cards may timeout. Disable if you're having problems
card.partialBlockRead(true);
// Now we will look for a FAT partition!
uint8_t part;
for (part = 0; part < 5; part++) { // we have up to 5 slots to look in
FAIL HERE
if (vol.init(card, part))
break; // we found one, lets bail
}
if (part == 5) { // if we ended up not finding one :(
putstring_nl("No valid FAT partition!");
sdErrorCheck(); // Something went wrong, lets print out why
while(1); // then 'halt' - do nothing!
}
// Lets tell the user about what we found
putstring("Using partition ");
Serial.print(part, DEC);
putstring(", type is FAT");
Serial.println(vol.fatType(),DEC); // FAT16 or FAT32?
// Try to open the root directory
if (!root.openRoot(vol)) {
putstring_nl("Can't open root dir!"); // Something went wrong,
while(1); // then 'halt' - do nothing!
}
// Whew! We got past the tough parts.
putstring_nl("Files found:");
dirLevel = 0;
// Print out all of the files in all the directories.
lsR(root);
}
//////////////////////////////////// LOOP
void loop() {
root.rewind();
play(root);
}
/////////////////////////////////// HELPERS
**EXCLUDED THE REST AS IT GETS PRETTY BIG, SEE THE DAPHC example apart of the library
Any help would be greatly appreciated. I would like to be able to get both libraries to work together. Could someone point me in the right direction to determine the conflict between the two libraries?