wave shield and analog pins

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
ashapiro
 
Posts: 27
Joined: Tue Oct 23, 2012 3:25 pm

wave shield and analog pins

Post by ashapiro »

My project uses all six of the analog pins to control the lighting of LEDs. I would like to use the Wave Shield to add audio while the LEDs are flashing. In my previous request I was assured that that is possible. But I now find that the Wave Shield uses pins 13, 12, 11, and 10 for the SD and pins 3 and 5 are used for the DAC. Is there a conflict? Is there a way to use the analog pins for both purposes?

Arthur

User avatar
adafruit_support_bill
 
Posts: 88141
Joined: Sat Feb 07, 2009 10:11 am

Re: wave shield and analog pins

Post by adafruit_support_bill »

the Wave Shield uses pins 13, 12, 11, and 10 for the SD and pins 3 and 5 are used for the DAC. Is there a conflict?
Those are all digital pins. There is no conflict with the analog pins.

ashapiro
 
Posts: 27
Joined: Tue Oct 23, 2012 3:25 pm

Re: wave shield and analog pins

Post by ashapiro »

I guess I'm confused. I thought that pins 3,5,6,9,10,11 can be used as analog pins for the purpose of PWM and the control of LEDs. My current sketch uses all of them to control the flashing of 1, 2, or 3 banks of LEDs and there are a total of 6 banks each connected to one of the analog pins. Am I under a mistaken impression that there is a difference between the six pins I listed that can be used as analog pins and the six analog input pins A0,...,A5? If not, how can pin 11, for example, be digital for the Wave Shield and analog for the PWM application? Can it be both at the same time?

Arthur

User avatar
adafruit_support_bill
 
Posts: 88141
Joined: Sat Feb 07, 2009 10:11 am

Re: wave shield and analog pins

Post by adafruit_support_bill »

We have a bit of confusion with the terminology:

"Analog Pins" are the 6 pins labeled A0-A5. They can be used for reading analog signals. They can also be used as digital pins (as they are in all the WaveShield 6-button examples).

Pins labeled 0-13 are known as the "Digital Pins". Pins 3,5,6,9,19 & 11 are also called "PWM pins". You control the PWM pins via "analogWrite", but they are not generally referred to as "analog pins".

So you do have a conflict with the PWM pins. But there are other options for PWM control of LEDs. :)

The 16 channel PWM breakout is controlled with just 2 pins (A4 & A5). http://www.adafruit.com/products/815
We also have RGB LED strands that can be controlled by any 2 pins. http://www.adafruit.com/index.php?main_ ... +%2Bstrand
And you can control a whole chain of Flora pixels with a single pin: http://www.adafruit.com/products/1260

ashapiro
 
Posts: 27
Joined: Tue Oct 23, 2012 3:25 pm

Re: wave shield and analog pins

Post by ashapiro »

Your response looks like really bad news. The second and third of your suggestions are out of the question. The problem with the first one is that I spent a couple of weeks completing the fairly complicated sketch for the LED part of the project (a sort of a "show") and now going the PWMServo route looks as though the entire programming for the LED part of the project would have to be redone. Can you think of another way to have the audio and the LED "show" play simultaneously?

Arthur

ashapiro
 
Posts: 27
Joined: Tue Oct 23, 2012 3:25 pm

Re: wave shield and analog pins

Post by ashapiro »

PS--Would it make any sense to use a second Arduino Uno for the audio via the Wave Shield as a slave to the first one (connected by I2C)?

Arthur

ashapiro
 
Posts: 27
Joined: Tue Oct 23, 2012 3:25 pm

Re: wave shield and analog pins

Post by ashapiro »

PPS--Would it help if the audio is in MP3 or some other format?
Arthur

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: wave shield and analog pins

Post by pburgess »

Hi Arthur,

Using a second Arduino as an I2C slave is one possibility. Serial may be easier, though you'll have to separate the two when uploading code (apparently it takes some extra hoops to do I2C slave on an Arduino -- never done it myself -- Google around, there seem to be some tutorials, I just haven't reviewed them in depth).

This is just one of those cases that highlights the Arduino can do any one thing really well, but walking and chewing gum at the same time is often problematic. The Wave Shield uses a majority of the Arduino's RAM and, as you've seen, is reliant on a few specific pins. You could reclaim some of the pins by tweaking WavePinDefs.h and rewiring the DAC lines on the shield, but not all six -- a couple are shared by the chip's SPI hardware, no way around it.

User avatar
adafruit_support_bill
 
Posts: 88141
Joined: Sat Feb 07, 2009 10:11 am

Re: wave shield and analog pins

Post by adafruit_support_bill »

There is also a "SoftPWM" library out there that is supposed to do PWM on any pin. It uses Timer2, so I don't think it will have any timer conflicts with the Wave Shield.

https://code.google.com/p/rogue-code/wi ... umentation

ashapiro
 
Posts: 27
Joined: Tue Oct 23, 2012 3:25 pm

Re: wave shield and analog pins

Post by ashapiro »

PBurgess
Thanks for the information on using 2 Arduinos. I'm sure I'll get this running one way or another.
Arthur

ashapiro
 
Posts: 27
Joined: Tue Oct 23, 2012 3:25 pm

Re: wave shield and analog pins

Post by ashapiro »

Thanks for the link to SoftPWM. It may very well do the trick.
Arthur

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

Return to “Arduino”