Can the WAVE Shield make sound without the SD?

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
pabluski
 
Posts: 4
Joined: Mon Nov 10, 2014 6:34 pm

Can the WAVE Shield make sound without the SD?

Post by pabluski »

I have a project that is using the Wave Shield with the SD - works nicely. However, there have been occasions where the SD card takes an I/O error. Usually the SD has been jarred and needs to be re-seated. On those occasions it would be very helpful to be able to produce an error tone or a beep-beep-beep or something like that. Is this possible with the Wave Shield or can it only be fed through the SD?

User avatar
kk6axq
 
Posts: 1
Joined: Wed Jan 14, 2015 6:48 pm

Re: Can the WAVE Shield make sound without the SD?

Post by kk6axq »

You could generate the tone on the Arduino and then wire a pin onto the signal pin of the audio jack... See the Arduino reference page for tone();
Hope that helps,

User avatar
pabluski
 
Posts: 4
Joined: Mon Nov 10, 2014 6:34 pm

Re: Can the WAVE Shield make sound without the SD?

Post by pabluski »

Yeah, I also considered putting a peizo device on there and trigger it with one of the pins.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Can the WAVE Shield make sound without the SD?

Post by adafruit_support_mike »

This thread has code from someone sending data directly to the Wave Shield's DAC:

http://forums.adafruit.com/viewtopic.ph ... 75#p106122

User avatar
pabluski
 
Posts: 4
Joined: Mon Nov 10, 2014 6:34 pm

Re: Can the WAVE Shield make sound without the SD?

Post by pabluski »

Mike, That is what I was looking for. Thanks.

I added this routine to my sketch:

Code: Select all

void dac_tone(int play4, int dlay) {
  for(int y=0;y<play4;y++){
    for(int i=0;i<360;i++) {
       wdt_reset (); // pat the dog
      mcpDacSend(255*sin(i));
      delayMicroseconds(dlay);
    }
  }
}
And then I call it this way for a "powering down" sound, or an error beep sequence:

Code: Select all

void powerdown(int beeps) {
    pinMode(SHUSH_PIN,OUTPUT); //disable the shush pin
    if(beeps>0) {
      dac_tone(10,1);
      delay(500);
      for(int i=0;i<beeps;i++){
        dac_tone(1,5);
        delay(100);
      }
      delay(500);
      dac_tone(10,1);
    } else {
      dac_tone(1,5);
      dac_tone(1,10);
      dac_tone(1,20);
      dac_tone(1,40);
      dac_tone(1,80);
    }    
    digitalWrite(POWDOWN_PIN,1); // tell the Pololu module to cut power
    while(1); // hang 
}


Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”