Waveshield with pins 12 and 13

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

Moderators: adafruit_support_bill, adafruit

Waveshield with pins 12 and 13

Postby shifter47 » Sat Mar 24, 2012 6:35 am

Hi guys,

I'm trying to use the Waveshield to play sounds from a step sequencer. I trimmed down the code from the "Play the wave file all the way through, and only once" 6 buttons and 6 sounds example sketch, to exclude the button presses. Essentially I just want the Waveshield to scroll through an array and play the sound files that are stored in it. My trouble is that I've run out of pins. I'm using 6,7,8,9 and 11, I need one more free pin but 12 and 13 are both sending information, even though I can't see any reference to them in the code. I assume it is something to do with the Waveshield part of the code? If it is part of the Waveshield, is it possible to free them up?

Thanks,

Tom
shifter47
 
Posts: 4
Joined: Sat Mar 24, 2012 6:26 am

Re: Waveshield with pins 12 and 13

Postby fat16lib » Sat Mar 24, 2012 7:55 am

Pins 11,12, and 13 are the SPI connection to the SD card. Pin 10 is the chip select pin for the SD card. These pins can't be used when playing sound. Access to the SPI pins is via SPDR in the code.

You can use analog pins as digital pins. In digital mode the analog pins are digital pins 14, 15, 16, 17, 18, and 19.
fat16lib
 
Posts: 586
Joined: Wed Dec 24, 2008 12:54 pm

Re: Waveshield with pins 12 and 13

Postby shifter47 » Sat Mar 24, 2012 8:01 am

Oh great, thanks for the fast reply!
shifter47
 
Posts: 4
Joined: Sat Mar 24, 2012 6:26 am

Re: Waveshield with pins 12 and 13

Postby shifter47 » Sat Mar 24, 2012 8:41 am

To save starting another thread:

Is it possible to edit the playfile function to call a String instead of a char? Simply changing "char" to "String" gives me the error:

error: cannot convert 'String' to 'String*' for argument '1' to 'void playfile(String*)'

These are the related variables:

Code: Select all
// string to store selected track filename
String currentTrack;

// array stores the filename to be played at each step
String steps[8];


When a button is pressed, the filename is stored in currentTrack (there are 3 readings because I'm using an encoder):

Code: Select all
if(track1 == LOW && track2 == HIGH && track3 == HIGH){
  currentTrack = "kick.wav";
}


When another button is pressed, the currentTrack file is stored at the corresponding slot in the steps[] array:

Code: Select all
if(step1 == HIGH && step2 == HIGH && step3 == HIGH){
  if(steps[0] == currentTrack){
  steps[0] = 0;
  }
  else{
  steps[0] = currentTrack;
  }
}


The error occurs when I try to play the file stored at one of the steps:

Code: Select all
playfile(steps[j]);
shifter47
 
Posts: 4
Joined: Sat Mar 24, 2012 6:26 am

Re: Waveshield with pins 12 and 13

Postby adafruit_support_bill » Sat Mar 24, 2012 11:37 am

Is it possible to edit the playfile function to call a String instead of a char?

the playfile function does not take a 'char'. It takes a 'char*' - meaning a 'pointer to a char', which is more-or-less equivalent to a string in C/C++.

What you changed it to was 'string*' which means 'pointer to a string', which is not the same thing as a 'string'.
User avatar
adafruit_support_bill
 
Posts: 15962
Joined: Sat Feb 07, 2009 9:11 am

Re: Waveshield with pins 12 and 13

Postby shifter47 » Sat Mar 24, 2012 2:30 pm

Thanks, I've got it working by changing my String variables to char*
shifter47
 
Posts: 4
Joined: Sat Mar 24, 2012 6:26 am

Re: Waveshield with pins 12 and 13

Postby paleorama » Tue May 22, 2012 10:27 pm

I allowed myself to continue this thread, as I am currently planning to build a sequencer for the wave shield.
I am very interested in seeing what your final code looked like! Do you have a "string" of commands for calling the .wav's and then reading some potentiometer for "scrolling" through the files to call?

Help is much appreciated, I'll be happy to share all my results in here when I get this working.

My final idea is to have a 8x8 LED matrix as the sequencer, driven by 4017 counter maybe.

Cheers!
paleorama
 
Posts: 6
Joined: Thu Oct 06, 2011 9:05 pm


Return to Arduino Shields from Adafruit

Who is online

Users browsing this forum: No registered users and 8 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [100]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
Android[6]
 
BeagleBone[24]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]
cron