I have successfully assembled the Wave Shield and played audio files using the sketch daphc.pde.
Now I would like to use the Wave Shield with another SPI device, and want to change the Wave's Slave Select line from 10 to 6.
I've changed the hardware jumper. What changes to the daphc.pde code are needed to enable this hardware change?
Thanks!
Using Wave Shield and second SPI device
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- RogerRobot
- Posts: 16
- Joined: Wed Jul 16, 2014 1:43 pm
Re: Using Wave Shield and second SPI device
OK - I found my own answer via Forum.Arduino.cc!
Here's the added code that lets it work:
Here's the added code that lets it work:
Code: Select all
/*
* Define macro to put error messages in flash memory
*/
#define error(msg) error_P(PSTR(msg))
//changed hardware select jumper from 10 to 6 - RGG
#define SS_PIN 6
// Function definitions (we define them here, but the code is below)
void play(FatReader &dir);
//////////////////////////////////// SETUP
void setup() {
pinMode(SS_PIN, OUTPUT); // RGG
pinMode(10, OUTPUT); // RGG
digitalWrite(SS_PIN,HIGH); //disable device - RGG
digitalWrite(10,HIGH); //physical SS pin high before setting SPCR - RGG
digitalWrite(SS_PIN,LOW); //enable device - RGG
Serial.begin(9600); // set up Serial library at 9600 bps for debugging
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Using Wave Shield and second SPI device
Glad to hear you got it working. ;-)
- RogerRobot
- Posts: 16
- Joined: Wed Jul 16, 2014 1:43 pm
Re: Using Wave Shield and second SPI device
So I can successfully switch between devices and operate them separately.
However, I want to send commands to a TLC5947 24-Channel 12-bit PWM LED Driver to animate LEDs while the Wave Shield is playing an audio file.
This seems like a pretty standard need (sound and lights). Can you point me to any sketches that show how to make this happen?
Thanks!
However, I want to send commands to a TLC5947 24-Channel 12-bit PWM LED Driver to animate LEDs while the Wave Shield is playing an audio file.
This seems like a pretty standard need (sound and lights). Can you point me to any sketches that show how to make this happen?
Thanks!
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Using Wave Shield and second SPI device
It's common, but unfortunately more than a microcontroller can handle.
What you've described is a 'multitasking' operation: a processor doing two things at the same time, ideally without weaving the code for them together into a single nightmare of specified timing. It's possible, but you need an operating system to maintain the isolation between tasks and handle the resources.
An Arduino doesn't have enough oomph for that. It can pull audio data from an SD card and send it to the ADC fast enough to keep the sound from stuttering, or it can run a lightshow, but it can't juggle both at the same time.
All of our projects that blink LEDs in time to music take the audio signal as an input from some other device.
What you've described is a 'multitasking' operation: a processor doing two things at the same time, ideally without weaving the code for them together into a single nightmare of specified timing. It's possible, but you need an operating system to maintain the isolation between tasks and handle the resources.
An Arduino doesn't have enough oomph for that. It can pull audio data from an SD card and send it to the ADC fast enough to keep the sound from stuttering, or it can run a lightshow, but it can't juggle both at the same time.
All of our projects that blink LEDs in time to music take the audio signal as an input from some other device.
Please be positive and constructive with your questions and comments.