DJ, i can’t even begin to understand till you post a sample of the code that interacts with the accelerometer. if i had to guess, id say you have some noise in the PWM of the speakers,… distorted how? can you make a video?
also the clicking? ,… hmm. sounds like the accelerometer is tweaking the arduino to send junk to the WT. why dont you just drop $3.50 and do analog sensors like Jakes MKII. i did. they are good. more than good. fine and dandy. as long as you position them correctly and understand how they work,… you can move in contrived ways that really make the thing sing. also,… if you want perfect sounds during a good rough duel,… seriously,. nothing on the market will do it. i have seen very expensive light saber duels, and they sound like poorly dubbed videos, and the smacking of polycarbonate will be louder than it all.
darkside:
ok i am guessing that the +5V in #6 indicates the 5V regulator which connects to both boards in the diagram. and the led mossfet gates i think i have figured out.
do not use a regulator. waste of space. the arduino does it for you if you go to the RAW in pin. 5v-12v unregulated power… AKA a battery.
also,. no offense to Jake,… his diagram does not go into proper mosfet wiring nor how he delivers the correct voltage/current to the LEDs. the attached photo will walk you thru how to do it with out a regulator, and WITH an led DRIVER, and how to wire the mosfet. the mosfet is tied to the WT588 and the LED in my setup. turning off both LED and WT when there is no audio to play is not a bad thing.
also,… to bypass default or interrupt hum,… just program the WT so that every activation sound, except for blade off, is followed by 20-30 seconds of hum looped. it wont take up any more space on the device and plays seamlessly with less or no gaps.
so in the WT programer:
0x00 off sound,… no hum.
0x01 on sound, followed by 30 seconds of hum
0x02 swing sound, 20 seconds of hum,
0x03 clash sound, 20 seconds of hum
etc
etc
you need 6 arduino commands,.
//button toggle code of choice
turn on led (or truly, send a pin HIGH state to the MOSFET)
turn off led (send a LOW state to the MOSFET
//button toggle code of choice
play on sound (0x01) ( this should play 10ms after the turn on LED high state. the WT needs 5-10ms to… “boot up”)
play off sound (0x00)
play clash (0x03)
play swing (0x02)
[img http://forum.arduino.cc/index.php?action=dlattach;topic=261980.0;attach=152407[/img]
if you are using an accelerometer,. all of the above info may be moot. i actually like the analog swing sensors. and the alternating debounce button codes with 100ms delays seems to really kill it!! good swings, nice clashes,.and also a reversed debounce function to throw in alternating swing and clash sounds, if they happen close together,. meaning… a single swing with go HUM. a full 360 or 2 swing triggers in less than 1000ms but more than 200ms will go zHum, VRhurm. one hit will go CLAShh! 2 hits in less than 1000ms, but more than 200ms will go Clashh, Cleeerchzzs!
capice?
sometimes the above doesn’t work perfect or the same everytime, and gets rather random with you are moving around for a few minutes and holding the saber in wierd positions before you swing or clash it,… but random is fine with me too! the real key is the right sound type plays when it should.
i don’t even have a hum command or interrupt for arduino. heck i don’t even have one on the WT,. the sound is of course loaded to the WT, bu no Hex address has it to play. it is just the tail of all the other sounds
in my off LED command, i also give it (1200) delay so,… the LED turns off, JUST as the off sound resolves,… the LOW state also cuts power to the WT sound module. this is so there are no false positives from the swing and clash sensors. and again, less arduino code to mull over. nothing says OFF like cutting the power. no code needed.