Pages: 1 ... 5 6 [7] 8 9 ... 16   Go Down
Author Topic: Arduino library for WTV020-SD-16P audio module  (Read 94829 times)
0 Members and 3 Guests are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You do not use the diodes in the signal lines from the arduino to the RST/Din/Dclk lines. You need them in the vcc+ to the sound module to reduce the voltage to 3.3 vdc.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Even not needing them for the signals i don't think it is a good idea to use 5v signals for a 3.3V working peripheral no? I'm not sure of it as the datasheet of this chip is the worst i've ever seen...there is a lot of information missing there.

Although not needing the diodes for signal i've use the the way shown in the image i posted...and i can't understand the reason for them to work with that polarization...if someone could explain the reason i'll be very pleased

thanks a lot!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is my example of a Star Wars Blaster with 8 RGB LEDs, 3 74HC595 shift registers and the WTV020-SD-16P sound card. The sound files are from onesky.

74HC595 shift registers wiring: http://www.arduino.cc/en/Tutorial/ShiftOut



Code:
//  Name    : Blaster4                                          //
//  Author  : Norman McGuffey                                   //
//  Date    : 16 Feb 2013                                       //
//  Version : 1.0                                               //
//  Notes   : Code for using 3 74HC595 Shift Registers with     //
//          : 8 - 5mm Superbright CC RGB LEDs on E-11 Blaster   //
//          : Sound using WTV020-SD-16P microSD audio module    //

int resetPin2 = 2;  // Pin D2 connected to WTV20 /Reset (Pin 1)
int clockPin2 = 3;  // Pin D3 connected to WTV20 P04 (clock)(Pin 7)
int dataPin2 = 4;   // Pin D4 connected to WTV20 P05 (data)(Pin 10)
int button1Pin = 6; // Pin D6 connected to Trigger Switch
int button2Pin = 7; // Pin D7 connected to Select Switch
int latchPin = 8;   // Pin D8 connected to ST_CP (PIN 12)of 74HC595
int dataPin = 11;   // Pin D11 connected to DS (PIN 14) of 74HC595
int clockPin = 12;  // Pin D12 connected to SH_CP (PIN 11)of 74HC595
int LEDPin = 13;    // Pin D13 connected to LED
int button1State = 0;
int button2State = 0;
int button2Count = 1;

const unsigned int VOLUME_0 = 0xFFF0;
const unsigned int VOLUME_1 = 0xFFF1;
const unsigned int VOLUME_2 = 0xFFF2;
const unsigned int VOLUME_3 = 0xFFF3;
const unsigned int VOLUME_4 = 0xFFF4;
const unsigned int VOLUME_5 = 0xFFF5;
const unsigned int VOLUME_6 = 0xFFF6;
const unsigned int VOLUME_7 = 0xFFF7;

const unsigned int PLAY_PAUSE = 0xFFFE;
const unsigned int STOP = 0xFFFF;

byte dataRED;
byte dataGREEN;
byte dataBLUE;
int dataArrayRED[] = {1,8,64,0,0,0,0,0,0};
int dataArrayGREEN[] = {0,0,0,2,16,128,0,0,0};
int dataArrayBLUE[] = {0,0,0,0,0,0,4,32,0};


void setup() {
  pinMode(clockPin2, OUTPUT);
  pinMode(dataPin2, OUTPUT);
  pinMode(resetPin2, OUTPUT);
  pinMode(LEDPin, OUTPUT);
  
  digitalWrite(clockPin2, HIGH);
  digitalWrite(dataPin2, LOW);

  pinMode(latchPin, OUTPUT);
  pinMode(button1Pin, INPUT);
  pinMode(button2Pin, INPUT);
  
  digitalWrite(resetPin2, HIGH);
  delay(100);
  digitalWrite(resetPin2, LOW);
  delay(10);
  digitalWrite(resetPin2, HIGH);
  delay(100);
  delay(500);
  sendCommand(0xFFF6);
 
  digitalWrite(LEDPin, HIGH);
  delay(50);
  digitalWrite(LEDPin, LOW);
  
  Serial.begin(9600);

}

void loop() {

  button2State = digitalRead(button2Pin);
  if (button2State == HIGH) {
    sendCommand(0x000);
    button2Count = button2Count +1;
    if (button2Count > 5) {
      button2Count = 1;
    }
    for (int x=0; x < button2Count; x++){
       digitalWrite(LEDPin, HIGH);
       delay(100);
       digitalWrite(LEDPin, LOW);
       delay(200);
    }
    delay(500);
    }
  
  button1State = digitalRead(button1Pin);
  
  if (button1State == HIGH) {    
   switch (button2Count) {
   case 1:
      { // Color = Red
      sendCommand(0x001);
      int dataArrayRED[] = {1,8,64,0,0,0,0,0,0};
      int dataArrayGREEN[] = {0,0,0,2,16,128,0,0,0};
      int dataArrayBLUE[] = {32,32,32,32,32,32,36,32,0};
      for (int j = 0; j < 9; j++) {
         dataRED = dataArrayRED[j];
         dataGREEN = dataArrayGREEN[j];
         dataBLUE = dataArrayBLUE[j];
         digitalWrite(latchPin, 0);
         shiftOut(dataPin, clockPin, dataBLUE);
         shiftOut(dataPin, clockPin, dataGREEN);  
         shiftOut(dataPin, clockPin, dataRED);
         digitalWrite(latchPin, 1);
         delay(60);}
       break;}
  case 2:
       { // Color = Blue
       sendCommand(0x002);
       int dataArrayRED[] = {4,32,0,0,0,0,0,0,0};
       int dataArrayGREEN[] = {0,0,1,8,64,0,0,0,0};
       int dataArrayBLUE[] = {128,128,128,128,128,130,144,128,0};
       for (int j = 0; j < 9; j++) {
         dataRED = dataArrayRED[j];
         dataGREEN = dataArrayGREEN[j];
         dataBLUE = dataArrayBLUE[j];
         digitalWrite(latchPin, 0);
         shiftOut(dataPin, clockPin, dataBLUE);
         shiftOut(dataPin, clockPin, dataGREEN);  
         shiftOut(dataPin, clockPin, dataRED);
         digitalWrite(latchPin, 1);
         delay(100);}
       break;}
    case 3:
       { // Color = Green
       sendCommand(0x003);
       int dataArrayRED[] = {2,16,128,0,0,0,0,0,0};
       int dataArrayGREEN[] = {0,0,0,4,32,0,0,0,0};
       int dataArrayBLUE[] = {64,64,64,64,64,65,72,64,0};
       for (int j = 0; j < 9; j++) {
         dataRED = dataArrayRED[j];
         dataGREEN = dataArrayGREEN[j];
         dataBLUE = dataArrayBLUE[j];
         digitalWrite(latchPin, 0);
         shiftOut(dataPin, clockPin, dataBLUE);
         shiftOut(dataPin, clockPin, dataGREEN);  
         shiftOut(dataPin, clockPin, dataRED);
         digitalWrite(latchPin, 1);
         delay(90);}
       break;}
    case 4:
       { // Color = Purple
       sendCommand(0x004);
       int dataArrayRED[] = {5,40,64,0,0,0,0,0,0};
       int dataArrayGREEN[] = {0,0,1,10,80,128,0,0,0};
       int dataArrayBLUE[] = {160,160,160,160,160,162,180,160,0};
         for (int j = 0; j < 9; j++) {
         dataRED = dataArrayRED[j];
         dataGREEN = dataArrayGREEN[j];
         dataBLUE = dataArrayBLUE[j];
         digitalWrite(latchPin, 0);
         shiftOut(dataPin, clockPin, dataBLUE);
         shiftOut(dataPin, clockPin, dataGREEN);  
         shiftOut(dataPin, clockPin, dataRED);
         digitalWrite(latchPin, 1);
         delay(90);}
       break;}
    case 5:
       { // Color = Orange
       sendCommand(0x005);
       int dataArrayRED[] = {3,24,192,0,0,0,0,0,0};
       int dataArrayGREEN[] = {0,0,0,6,48,128,0,0,0};
       int dataArrayBLUE[] = {96,96,96,96,96,97,108,96,0};
       for (int j = 0; j < 9; j++) {
         dataRED = dataArrayRED[j];
         dataGREEN = dataArrayGREEN[j];
         dataBLUE = dataArrayBLUE[j];
         digitalWrite(latchPin, 0);
         shiftOut(dataPin, clockPin, dataBLUE);
         shiftOut(dataPin, clockPin, dataGREEN);  
         shiftOut(dataPin, clockPin, dataRED);
         digitalWrite(latchPin, 1);
         delay(75);}
       break;}
   }
  }
}

void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {

  int i=0;
  int pinState;
  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, OUTPUT);
 
  digitalWrite(myDataPin, 0);
  digitalWrite(myClockPin, 0);
  
  for (i=7; i>=0; i--)  {
    digitalWrite(myClockPin, 0);
    
    if ( myDataOut & (1<<i) ) {
      pinState= 1;
    }
    else {
      pinState= 0;
    }
    digitalWrite(myDataPin, pinState);
    digitalWrite(myClockPin, 1);
    digitalWrite(myDataPin, 0);
  }
    digitalWrite(myClockPin, 0);
}

void blinkAll_3Bytes(int n, int d) {
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, 0);
  shiftOut(dataPin, clockPin, 0);
  digitalWrite(latchPin, 1);
  delay(200);
  for (int x = 0; x < n; x++) {
    digitalWrite(latchPin, 0);
    shiftOut(dataPin, clockPin, 0);
    shiftOut(dataPin, clockPin, 0);
    shiftOut(dataPin, clockPin, 1);
    digitalWrite(latchPin, 1);
    delay(50);
    digitalWrite(latchPin, 0);
    shiftOut(dataPin, clockPin, 0);
    shiftOut(dataPin, clockPin, 0);
    shiftOut(dataPin, clockPin, 0);
    digitalWrite(latchPin, 1);
    delay(200);
  }
}
void sendCommand(int addr)
{
  digitalWrite(clockPin2, LOW);
  delay(2);
  for (int i=15; i>=0; i--)
  {
    delayMicroseconds(200);
    if((addr>>i)&0x0001 >0)
      {
        digitalWrite(dataPin2, HIGH);
       }
    else
       {
         digitalWrite(dataPin2, LOW);
       }
    delayMicroseconds(200);
    digitalWrite(clockPin2, HIGH);
    delayMicroseconds(200);
    
    if(i>0)
    digitalWrite(dataPin2, LOW);
    else
    digitalWrite(dataPin2, HIGH);
    delayMicroseconds(200);
    
    if(i>0)
    digitalWrite(clockPin2, LOW);
    else
    digitalWrite(clockPin2, HIGH);
  }
  delay(30);
}
« Last Edit: February 25, 2013, 04:33:39 pm by ntmcguff » Logged

Guangzhou,Guangdong,China
Offline Offline
Newbie
*
Karma: 0
Posts: 8
waytronic(WT)--manufacturer and designer of sound module,voice chip ,recording module.WT have designed WTV,WTH.WTN3 series voice chip,WTV020-SD,WTV020-S ,WT588D,WT5001M01-M04 ,WTM-SD,WT9501M03,WT8603 etc voice module
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi the-rebel-agent,

Hats off for sharing your experience smiley

I am going to play with the same module but decided to ask and get the pin diagram confirmed. I found the following application circuit for this device.



I believe the following is the way of identifying the pins. Can you please confirm? smiley



/Chathuranga


Yes, the way of identifying the pins is right----waytronic -Jasmine. Manufacturer of WTV020-SD module
Logged

waytronic(WT)--manufacturer and designer of sound module,voice chip ,recording module.WT have designed WTV,WTH.WTN3 series voice chip,WTV020

Guangzhou,Guangdong,China
Offline Offline
Newbie
*
Karma: 0
Posts: 8
waytronic(WT)--manufacturer and designer of sound module,voice chip ,recording module.WT have designed WTV,WTH.WTN3 series voice chip,WTV020-SD,WTV020-S ,WT588D,WT5001M01-M04 ,WTM-SD,WT9501M03,WT8603 etc voice module
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice Stuff smiley

I will add my findings etc when I continue with my experiments. I am about to start smiley

The Datasheet says the maximum supported size of the Card is 1GB. Is that so or could you be able to use a card with higher capacity? I cannot imagine a reason of limiting the size at 1 GB because generally the address spaces are larger than that..  smiley-confuse

acctually it can support 2 GB,we have tested 2GB TF card,same use with 1GB TF card.some times manual will have something wrong,and we will revise them when we discover them.and welcome every one to help us point out them.
Logged

waytronic(WT)--manufacturer and designer of sound module,voice chip ,recording module.WT have designed WTV,WTH.WTN3 series voice chip,WTV020

Guangzhou,Guangdong,China
Offline Offline
Newbie
*
Karma: 0
Posts: 8
waytronic(WT)--manufacturer and designer of sound module,voice chip ,recording module.WT have designed WTV,WTH.WTN3 series voice chip,WTV020-SD,WTV020-S ,WT588D,WT5001M01-M04 ,WTM-SD,WT9501M03,WT8603 etc voice module
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I  just got from China a board : V1.5 / 2012.01.12", and "5v  / 3.3v

The only successfully way to format my Nokia mirco SD 512 MB
was win / cmd(Admin) / diskpart .
( http://www.chip.de/bildergalerie/Windows-To-Go-So-laeuft-Windows-8-auf-USB-Sticks-und-Festplatten-Galerie_54926063.html)

Up to now I run the board stand alone.
OK Files:
- 000X.ad4
- 000x.wav   freq 12.000 Mono and -1dB

It is possible to run MP3 im stand alone modus ?

WTV020-SD module only can play WAV and AD4 file
Logged

waytronic(WT)--manufacturer and designer of sound module,voice chip ,recording module.WT have designed WTV,WTH.WTN3 series voice chip,WTV020

Guangzhou,Guangdong,China
Offline Offline
Newbie
*
Karma: 0
Posts: 8
waytronic(WT)--manufacturer and designer of sound module,voice chip ,recording module.WT have designed WTV,WTH.WTN3 series voice chip,WTV020-SD,WTV020-S ,WT588D,WT5001M01-M04 ,WTM-SD,WT9501M03,WT8603 etc voice module
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!
I have a question!
How to manually change modes on vtv020-sd-16p,all ekys are on/off(loop),key 5 group of voice...
Thanks!!!

I want to ask which control mode module do you use?for example ,If you buy 2-wire series mode can not us key 5 group of voice,control mode is fixed when we program main chip,and you need tell supplier what you want,i think they will give you correct control mode module.
Logged

waytronic(WT)--manufacturer and designer of sound module,voice chip ,recording module.WT have designed WTV,WTH.WTN3 series voice chip,WTV020

Guangzhou,Guangdong,China
Offline Offline
Newbie
*
Karma: 0
Posts: 8
waytronic(WT)--manufacturer and designer of sound module,voice chip ,recording module.WT have designed WTV,WTH.WTN3 series voice chip,WTV020-SD,WTV020-S ,WT588D,WT5001M01-M04 ,WTM-SD,WT9501M03,WT8603 etc voice module
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been working with a Somo-14D recently on a lightsaber project.  I got it generally working until I realized that it couldn't do gapless playback.  The gap was very small, but very noticeable when going from a swing directly into a hum.

Do you know if this module can do gapless playback?  I know the two units are similar, I just don't know how similar.

Thanks!

yes,it is same.it use same main control chip( WTV020 chip) and same program.

about gapless playback,WTV020-SD 16P can not do that,SD card response need some time,and main control can not do so fast communicate with SD card.

How long does your sound,maybe you can try SPI flash solution,it will response faster than SD card.

Logged

waytronic(WT)--manufacturer and designer of sound module,voice chip ,recording module.WT have designed WTV,WTH.WTN3 series voice chip,WTV020

Barcelona
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Shared it on gallery section. Look for v laser gun.

Sorry for this silly question.... but,   I'm unable to find the files.

Any ideas where have they gone ??

Gracias,
Rafa.
Logged

Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

http://arduino.cc/forum/index.php/topic,110328.msg1113991.html#msg1113991
Logged

Barcelona
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Got them... Thanks Sir!.
Logged

Barcelona
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For the experiences I've read about this module....
Could it be possible to Sumarize your experiences and configuration??
(I'm getting frustrated because of wrong SDs -I've already checked 4-)

Jumper : 3.3 or 5 v
SD: Brand, Size, Format...
AD4 files: Speed, Rate, etc...


I think this will be a really usefull way to help new users for this module to be sucessful on their attemps.

NOTE:
And... Why not have that information populated under its own topic. "Audio players", "WTV020-SD-16P"
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

EA3BIL,

I am running my WTV020-SD-16P at 3.3 vdc powered from the arduino 5vdc with with 2 diodes to drop the voltage to 3.3 vdc on the vcc+ line.

I am using a Sandisk 1gb MicroSD card formatted to FAT16. You can go up to a 2gb card.

The speed and rate of the A4D files are listed in the earlier posts.

All the information you need should be contained in this series of posts. Go back to the first post and start reading. This is how I got mine to work.
Logged

Italy
Offline Offline
Full Member
***
Karma: 3
Posts: 151
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is my example of a Star Wars Blaster with 8 RGB LEDs, 3 74HC595 shift registers and the WTV020-SD-16P sound card. The sound files are from onesky.

74HC595 shift registers wiring: http://www.arduino.cc/en/Tutorial/ShiftOut



Code:
//  Name    : Blaster4                                          //
//  Author  : Norman McGuffey                                   //
//  Date    : 16 Feb 2013                                       //
//  Version : 1.0                                               //
//  Notes   : Code for using 3 74HC595 Shift Registers with     //
//          : 8 - 5mm Superbright CC RGB LEDs on E-11 Blaster   //
//          : Sound using WTV020-SD-16P microSD audio module    //

int resetPin2 = 2;  // Pin D2 connected to WTV20 /Reset (Pin 1)
int clockPin2 = 3;  // Pin D3 connected to WTV20 P04 (clock)(Pin 7)
int dataPin2 = 4;   // Pin D4 connected to WTV20 P05 (data)(Pin 10)
int button1Pin = 6; // Pin D6 connected to Trigger Switch
int button2Pin = 7; // Pin D7 connected to Select Switch
int latchPin = 8;   // Pin D8 connected to ST_CP (PIN 12)of 74HC595
int dataPin = 11;   // Pin D11 connected to DS (PIN 14) of 74HC595
int clockPin = 12;  // Pin D12 connected to SH_CP (PIN 11)of 74HC595
int LEDPin = 13;    // Pin D13 connected to LED
int button1State = 0;
int button2State = 0;
int button2Count = 1;

const unsigned int VOLUME_0 = 0xFFF0;
const unsigned int VOLUME_1 = 0xFFF1;
const unsigned int VOLUME_2 = 0xFFF2;
const unsigned int VOLUME_3 = 0xFFF3;
const unsigned int VOLUME_4 = 0xFFF4;
const unsigned int VOLUME_5 = 0xFFF5;
const unsigned int VOLUME_6 = 0xFFF6;
const unsigned int VOLUME_7 = 0xFFF7;

const unsigned int PLAY_PAUSE = 0xFFFE;
const unsigned int STOP = 0xFFFF;

byte dataRED;
byte dataGREEN;
byte dataBLUE;
int dataArrayRED[] = {1,8,64,0,0,0,0,0,0};
int dataArrayGREEN[] = {0,0,0,2,16,128,0,0,0};
int dataArrayBLUE[] = {0,0,0,0,0,0,4,32,0};


void setup() {
  pinMode(clockPin2, OUTPUT);
  pinMode(dataPin2, OUTPUT);
  pinMode(resetPin2, OUTPUT);
  pinMode(LEDPin, OUTPUT);
  
  digitalWrite(clockPin2, HIGH);
  digitalWrite(dataPin2, LOW);

  pinMode(latchPin, OUTPUT);
  pinMode(button1Pin, INPUT);
  pinMode(button2Pin, INPUT);
  
  digitalWrite(resetPin2, HIGH);
  delay(100);
  digitalWrite(resetPin2, LOW);
  delay(10);
  digitalWrite(resetPin2, HIGH);
  delay(100);
  delay(500);
  sendCommand(0xFFF6);
 
  digitalWrite(LEDPin, HIGH);
  delay(50);
  digitalWrite(LEDPin, LOW);
  
  Serial.begin(9600);

}

void loop() {

  button2State = digitalRead(button2Pin);
  if (button2State == HIGH) {
    sendCommand(0x000);
    button2Count = button2Count +1;
    if (button2Count > 5) {
      button2Count = 1;
    }
    for (int x=0; x < button2Count; x++){
       digitalWrite(LEDPin, HIGH);
       delay(100);
       digitalWrite(LEDPin, LOW);
       delay(200);
    }
    delay(500);
    }
  
  button1State = digitalRead(button1Pin);
  
  if (button1State == HIGH) {    
   switch (button2Count) {
   case 1:
      { // Color = Red
      sendCommand(0x001);
      int dataArrayRED[] = {1,8,64,0,0,0,0,0,0};
      int dataArrayGREEN[] = {0,0,0,2,16,128,0,0,0};
      int dataArrayBLUE[] = {32,32,32,32,32,32,36,32,0};
      for (int j = 0; j < 9; j++) {
         dataRED = dataArrayRED[j];
         dataGREEN = dataArrayGREEN[j];
         dataBLUE = dataArrayBLUE[j];
         digitalWrite(latchPin, 0);
         shiftOut(dataPin, clockPin, dataBLUE);
         shiftOut(dataPin, clockPin, dataGREEN);  
         shiftOut(dataPin, clockPin, dataRED);
         digitalWrite(latchPin, 1);
         delay(60);}
       break;}
  case 2:
       { // Color = Blue
       sendCommand(0x002);
       int dataArrayRED[] = {4,32,0,0,0,0,0,0,0};
       int dataArrayGREEN[] = {0,0,1,8,64,0,0,0,0};
       int dataArrayBLUE[] = {128,128,128,128,128,130,144,128,0};
       for (int j = 0; j < 9; j++) {
         dataRED = dataArrayRED[j];
         dataGREEN = dataArrayGREEN[j];
         dataBLUE = dataArrayBLUE[j];
         digitalWrite(latchPin, 0);
         shiftOut(dataPin, clockPin, dataBLUE);
         shiftOut(dataPin, clockPin, dataGREEN);  
         shiftOut(dataPin, clockPin, dataRED);
         digitalWrite(latchPin, 1);
         delay(100);}
       break;}
    case 3:
       { // Color = Green
       sendCommand(0x003);
       int dataArrayRED[] = {2,16,128,0,0,0,0,0,0};
       int dataArrayGREEN[] = {0,0,0,4,32,0,0,0,0};
       int dataArrayBLUE[] = {64,64,64,64,64,65,72,64,0};
       for (int j = 0; j < 9; j++) {
         dataRED = dataArrayRED[j];
         dataGREEN = dataArrayGREEN[j];
         dataBLUE = dataArrayBLUE[j];
         digitalWrite(latchPin, 0);
         shiftOut(dataPin, clockPin, dataBLUE);
         shiftOut(dataPin, clockPin, dataGREEN);  
         shiftOut(dataPin, clockPin, dataRED);
         digitalWrite(latchPin, 1);
         delay(90);}
       break;}
    case 4:
       { // Color = Purple
       sendCommand(0x004);
       int dataArrayRED[] = {5,40,64,0,0,0,0,0,0};
       int dataArrayGREEN[] = {0,0,1,10,80,128,0,0,0};
       int dataArrayBLUE[] = {160,160,160,160,160,162,180,160,0};
         for (int j = 0; j < 9; j++) {
         dataRED = dataArrayRED[j];
         dataGREEN = dataArrayGREEN[j];
         dataBLUE = dataArrayBLUE[j];
         digitalWrite(latchPin, 0);
         shiftOut(dataPin, clockPin, dataBLUE);
         shiftOut(dataPin, clockPin, dataGREEN);  
         shiftOut(dataPin, clockPin, dataRED);
         digitalWrite(latchPin, 1);
         delay(90);}
       break;}
    case 5:
       { // Color = Orange
       sendCommand(0x005);
       int dataArrayRED[] = {3,24,192,0,0,0,0,0,0};
       int dataArrayGREEN[] = {0,0,0,6,48,128,0,0,0};
       int dataArrayBLUE[] = {96,96,96,96,96,97,108,96,0};
       for (int j = 0; j < 9; j++) {
         dataRED = dataArrayRED[j];
         dataGREEN = dataArrayGREEN[j];
         dataBLUE = dataArrayBLUE[j];
         digitalWrite(latchPin, 0);
         shiftOut(dataPin, clockPin, dataBLUE);
         shiftOut(dataPin, clockPin, dataGREEN);  
         shiftOut(dataPin, clockPin, dataRED);
         digitalWrite(latchPin, 1);
         delay(75);}
       break;}
   }
  }
}

void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {

  int i=0;
  int pinState;
  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, OUTPUT);
 
  digitalWrite(myDataPin, 0);
  digitalWrite(myClockPin, 0);
  
  for (i=7; i>=0; i--)  {
    digitalWrite(myClockPin, 0);
    
    if ( myDataOut & (1<<i) ) {
      pinState= 1;
    }
    else {
      pinState= 0;
    }
    digitalWrite(myDataPin, pinState);
    digitalWrite(myClockPin, 1);
    digitalWrite(myDataPin, 0);
  }
    digitalWrite(myClockPin, 0);
}

void blinkAll_3Bytes(int n, int d) {
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, 0);
  shiftOut(dataPin, clockPin, 0);
  digitalWrite(latchPin, 1);
  delay(200);
  for (int x = 0; x < n; x++) {
    digitalWrite(latchPin, 0);
    shiftOut(dataPin, clockPin, 0);
    shiftOut(dataPin, clockPin, 0);
    shiftOut(dataPin, clockPin, 1);
    digitalWrite(latchPin, 1);
    delay(50);
    digitalWrite(latchPin, 0);
    shiftOut(dataPin, clockPin, 0);
    shiftOut(dataPin, clockPin, 0);
    shiftOut(dataPin, clockPin, 0);
    digitalWrite(latchPin, 1);
    delay(200);
  }
}
void sendCommand(int addr)
{
  digitalWrite(clockPin2, LOW);
  delay(2);
  for (int i=15; i>=0; i--)
  {
    delayMicroseconds(200);
    if((addr>>i)&0x0001 >0)
      {
        digitalWrite(dataPin2, HIGH);
       }
    else
       {
         digitalWrite(dataPin2, LOW);
       }
    delayMicroseconds(200);
    digitalWrite(clockPin2, HIGH);
    delayMicroseconds(200);
    
    if(i>0)
    digitalWrite(dataPin2, LOW);
    else
    digitalWrite(dataPin2, HIGH);
    delayMicroseconds(200);
    
    if(i>0)
    digitalWrite(clockPin2, LOW);
    else
    digitalWrite(clockPin2, HIGH);
  }
  delay(30);
}

very well!
did you post your video in whitearmor forum too?
http://www.whitearmor.net/forum/topic/19322-arduino-a-cheap-board-for-e11-blaster-effects/page__st__120
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

onesky,

I posted on whitearmour forum in a new topic here:
http://www.whitearmor.net/forum/topic/23198-another-arduind-e-11-blaster-setup/
Logged

Pages: 1 ... 5 6 [7] 8 9 ... 16   Go Up
Jump to: