Activate adafruit audiofx sound board with ir remote? REWARD!!!!

Absolutely all at your own risk; I haven't spent much time looking at it, it probably won't work:

The Adafruit Audio FX Sound Board runs off 3 to 5.5V, so you can power it straight from your breadboard power rails to Vin and GND.
Choose a pin on your Thundercloud Arduino, I'll assume pin 13, and connect it to whichever trigger pin you want to use on the Sound Board.

You'll probably want a latching audio file:

Latching Loop Trigger - name the file TnnLATCH.WAV or .OGG to have the audio start playing when the button is pressed momentarily, and repeats until the button is pressed again

In thundercloud_2.ino you need to make changes.

#define DATA_PIN 3

// Audio FX trigger pin
#define AUDIO_FX_PIN 13
enum Mode { CLOUD,ACID,OFF,ON,RED,GREEN,BLUE,WHITE,FADE,VOL_DOWN,VOL_UP,LUMENS_UP,LUMENS_DOWN,TRIG_FX};
void setup() { 
pinMode(AUDIO_FX_PIN, OUTPUT);
digitalWrite(AUDIO_FX_PIN, HIGH); // pull to ground to trigger
        case 0x3D:
          mode = LUMENS_UP; break;
        case 0x??:  // whatever code your remote spits out for the button you want to use
          mode = TRIG_FX; break;
    case LUMENS_UP: lumens_plus();break;
    case TRIG_FX: trigger_sound_effects();break;
void trigger_sound_effects(){
  // if the IR remote fires out multiple codes for one keypress, this function could be called multiple times
  // it may be necessary to "debounce" the codes, see what happens first
  digitalWrite(AUDIO_FX_PIN, LOW);
  delay(150); // since there are already delays in the code; if this is too long, it could be done by timing
  digitalWrite(AUDIO_FX_PIN, HIGH);
  mode=CLOUD;
}

arduarn:
Absolutely all at your own risk; I haven't spent much time looking at it, it probably won't work:

The Adafruit Audio FX Sound Board runs off 3 to 5.5V, so you can power it straight from your breadboard power rails to Vin and GND.
Choose a pin on your Thundercloud Arduino, I'll assume pin 13, and connect it to whichever trigger pin you want to use on the Sound Board.

You'll probably want a latching audio file:
In thundercloud_2.ino you need to make changes.

#define DATA_PIN 3

// Audio FX trigger pin
#define AUDIO_FX_PIN 13





enum Mode { CLOUD,ACID,OFF,ON,RED,GREEN,BLUE,WHITE,FADE,VOL_DOWN,VOL_UP,LUMENS_UP,LUMENS_DOWN,TRIG_FX};





void setup() {
pinMode(AUDIO_FX_PIN, OUTPUT);
digitalWrite(AUDIO_FX_PIN, HIGH); // pull to ground to trigger





case 0x3D:
         mode = LUMENS_UP; break;
       case 0x??:  // whatever code your remote spits out for the button you want to use
         mode = TRIG_FX; break;





case LUMENS_UP: lumens_plus();break;
   case TRIG_FX: trigger_sound_effects();break;





void trigger_sound_effects(){
 // if the IR remote fires out multiple codes for one keypress, this function could be called multiple times
 // it may be necessary to "debounce" the codes, see what happens first
 digitalWrite(AUDIO_FX_PIN, LOW);
 delay(150); // since there are already delays in the code; if this is too long, it could be done by timing
 digitalWrite(AUDIO_FX_PIN, HIGH);
 mode=CLOUD;
}

Thank you soooooo much!!

I added all the code you wrote in the correct place I thin, the only code I wasn't really sure where to pu is the last part (void trigger).

I compiled the file but I get the following errors.

'trigger_sound_effects' was not declared in this scope

And a bunch of other file error that where to many characters to post here.

webdiddy:
Thank you soooooo much!!

Wait until you know it works before you thank me.

webdiddy:
I added all the code you wrote in the correct place I thin, the only code I wasn't really sure where to pu is the last part (void trigger).

I compiled the file but I get the following errors.

'trigger_sound_effects' was not declared in this scope

And a bunch of other file error that where to many characters to post here.

trigger_sound_effects() can just be added to the end of the sketch, or anywhere outside of any functions.
If that doesn't fix the errors, then post your code and the error messages.

I tried moving the trigger sound effect code but I get the same error.

Sketch can be found here:

You've put trigger_sound_effects() inside of constant_lightning(). It needs to stand alone and not within any curly brackets { } and not inside any functions.

arduarn:
You've put trigger_sound_effects() inside of constant_lightning(). It needs to stand alone and not within any curly brackets { } and not inside any functions.

Just to be clear, we're talking about the last snippet of code right?

void trigger_sound_effects(){
  // if the IR remote fires out multiple codes for one keypress, this function could be called multiple times
  // it may be necessary to "debounce" the codes, see what happens first
  digitalWrite(AUDIO_FX_PIN, LOW);
  delay(150); // since there are already delays in the code; if this is too long, it could be done by timing
  digitalWrite(AUDIO_FX_PIN, HIGH);
  mode=CLOUD;
}

webdiddy:
Just to be clear, we're talking about the last snippet of code right?

void trigger_sound_effects(){

// if the IR remote fires out multiple codes for one keypress, this function could be called multiple times
  // it may be necessary to "debounce" the codes, see what happens first
  digitalWrite(AUDIO_FX_PIN, LOW);
  delay(150); // since there are already delays in the code; if this is too long, it could be done by timing
  digitalWrite(AUDIO_FX_PIN, HIGH);
  mode=CLOUD;
}

Yes. Don't be so afraid to experiment.

Okay, I think I have the last part of the code in the right place now.
However I am getting the error "ERROR COMPILING FOR BOARD ARDUINO/GENUNIO UNO."
Error code is to large to be pasted here so I'm attaching a text document to this post.

error.txt (22.5 KB)

webdiddy:
Okay, I think I have the last part of the code in the right place now.
However I am getting the error "ERROR COMPILING FOR BOARD ARDUINO/GENUNIO UNO."
Error code is to large to be pasted here so I'm attaching a text document to this post.

This was compiling and fully working before the changes - right?

You seem to be using the Arduino IDE 1.6.10, which is unnecessarily old. Update to the latest 1.8.4. Also go into the library manager and make sure you have the latest version of the FastLED library, you currently have 3.001.000 and I have just downloaded 3.001.006.

Otherwise, it compiles for me with the attached code.

thundercloud_with_sound_board.ino (9.8 KB)

First off all arduran, I'm really thank full for you trying to help me! :slight_smile:
Yes everyhing was working the last time I uploaded everthing to my Arduino Uno, however that was around a year ago and I have not been using this computer since.

I updated the software to the latest version and also made sure I had the latest fastled library (v3.1.0).

I am now getting a different error.
Please see attached TXT file.

error2.txt (38.5 KB)

webdiddy:
I am now getting a different error.
Please see attached TXT file.

The first errors are the same errors, not sure yet what is going on there.
The other errors are because you have multiple versions of the .ino file in the same directory. If you have an old version of the file that you want to keep, rename the extension on the end instead eg. .ino.old
When you compile, all the inos in the directory will be concatenated together, which will result in error messages.

I have now cleaned up my arduino folder trying to get the errors to a minimum.
I am still getting errors though.

Please see attached images of the errors and my folders. :slight_smile:

error3.txt (22.4 KB)

I can't help but think there is something broken about your FastLED library. Looking at the source on GitHub, there is a change in the code that is directly relevant to that first error message about the "scale8".
I also don't know why you are getting version 3.1.0 when I get 3.1.6.

How are you downloading the library - in the IDE using Sketch->Include Library->Manage Libraries?
When you use the search box and search for FastLED, click the More Info link, what versions do you see available in the drop-down?

If all else fails, you could try the cut-down/old library that is provided in the cloudlamp repository.

I updated the fastled library using the the library-manager like you instructed and OMG, it looks like it's working :slight_smile: I have not connected it to the leds yet but I can now turn off and on the sound fx board using the remote!

It looks like the default mode when powering everything on is with the sound on, is there a way to power it on with the sound off instead so I have the option to turn the sound on when I please? :slight_smile:

webdiddy:
It looks like the default mode when powering everything on is with the sound on, is there a way to power it on with the sound off instead so I have the option to turn the sound on when I please? :slight_smile:

It should already be starting with the sound off. Umm. Make sure you only have the one sound file saved on the device - the one that has the TnnLATCH.WAV filename format.

There where two files on there, I removed the unused file and now there's only T001LATCH.OGG on the device.
It still starts with the sound on though.

Try changing the code in setup() to this:

void setup() { 
digitalWrite(AUDIO_FX_PIN, HIGH);
 pinMode(AUDIO_FX_PIN, OUTPUT);
digitalWrite(AUDIO_FX_PIN, HIGH); // pull to ground to trigger

If that doesn't work, then connect a wire from the Audio FX board RST pin to GND/0V. Make absolutely sure that you are connecting it to GND - the RST pin is 3.3v logic, so connecting it to anything with 5v would be very bad.

After a few seconds of resulting silence, remove the wire and see if the sound starts up again automatically. Hopefully not.

arduarn:
Try changing the code in setup() to this:

void setup() { 

digitalWrite(AUDIO_FX_PIN, HIGH);
pinMode(AUDIO_FX_PIN, OUTPUT);
digitalWrite(AUDIO_FX_PIN, HIGH); // pull to ground to trigger




If that doesn't work, then connect a wire from the Audio FX board RST pin to GND/0V. Make absolutely sure that you are connecting it to GND - the RST pin is 3.3v logic, so connecting it to anything with 5v would be very bad.

After a few seconds of resulting silence, remove the wire and see if the sound starts up again automatically. Hopefully not.

The code update didn't make a difference sadly.

Should I connect a wire from RST to GND on the audio fx board only? Should I do this after power has been connected or before?

webdiddy:
Should I connect a wire from RST to GND on the audio fx board only? Should I do this after power has been connected or before?

You can do it with the power connected, just make sure you do it correctly. And yes, it is fine to just do it on the FX board.

I did a reset and now now it boots up in silence :slight_smile:
Now I just need to connect the leds to see if they're still working as they should :slight_smile:
I'll report back as soon as I know!