Arduino Lightsaber

finally. i had like 2 a ha moment. one is,. that i HATE coding,.. i thought Flash Action script and MEL was bad,.. I get an F- i C++
But, alas,.. my parents said i can do anything,. and my 5 year old pat me on the back last night and siad,. "But Dad, you told me Pealer's never give up."
i cracked it.

i dont know how i did it,. but i turned the sound module 180 degrees when moving it from one bread board to another. looked good on the board,. 100% broken. Do'h!

Illuis's code used a different SCL naming convention, that i did not catch,.. arduino did tho.

this works,.. anyone can use it,.. make sure you configure the sound uploading module to edge trigger.

videos to come... if you don't know how to make buttons trigger functions,.. billpealer at yahoo dont com. either way i will upload the final,.the updated button code,.. the line diagram, and full video in 2-3 weeks. i also want to add, that a $15 sound module in a star wars walmart light saber is dang near the same thing as this... just add the mosfet/2w LED and better 2w speaker to that and the Custom Saber Shop Sabers are good to go.

#define WT588D_SCL 9 //Module pin "P03" or pin # 10
#define WT588D_BUSY 10 //Module pin "LED/BUSY" or pin # 15

byte file_count = 1;

void setup() {

  
 pinMode(WT588D_SCL, OUTPUT);  
 pinMode(WT588D_BUSY, INPUT);  
 

}


void loop()
{
 WT588D_Send_Command(0x02);  //blade on with looped hum for 80 seconds. if you dont swing for 80 seconds, why is it on?
 delay(1500); //delay for testing  waiting for buttons from china. 

 WT588D_Send_Command(0x01); //swing sound with 80 seconds of hum
 delay(1000);
 WT588D_Send_Command(0x01); //one more swing sound 'cause it sounds cool
 delay(1000);
 WT588D_Send_Command(0x00); //powerdown sound, no hum loop. der.. its off.
 delay(4500);

 delay(200); 

}


void WT588D_Send_Command(byte addr) {
   digitalWrite(WT588D_SCL, LOW);
   delay(5);

   for(int i = 0; i < 8; i++)  {
       digitalWrite(WT588D_SCL, HIGH);
       if(bitRead(addr, i)) {
           delayMicroseconds(600);
           digitalWrite(WT588D_SCL, LOW);
           delayMicroseconds(200);
       } else {
           delayMicroseconds(200);
           digitalWrite(WT588D_SCL, LOW);
           delayMicroseconds(600);
       }
   }

   digitalWrite(WT588D_SCL, HIGH);
   delay(100);
} //END