Halloween Monster in A Box Project using a Digital Loggers IOT Relay

Hi- have we had any issues where the IOT Relay you sell (https://www.sparkfun.com/products/14236) conflicts with the MP3 Player Shield? (https://www.sparkfun.com/products/12660) My Sparkfun MP3 shield is the older VS1053 MP3 shield, but it works fine on its own. Also a simple program with the IOT relay works fine on its own- but when I combine the two I cannot make them work. Here is the project I am attempting to duplicate: https://create.arduino.cc/projecthub/cr … box-41cc38 Here is the simple code I use for the IOT relay:

#include <SPI.h>

//Add the SdFat Libraries
#include <SdFat.h>
#include <SdFatUtil.h>
//and the MP3 Shield Library
#include <SFEMP3Shield.h>

SdFat sd;
SFEMP3Shield MP3player;


void setup() {
  //start serial connection
  Serial.begin(9600);
  //configure pin 2 as an input and enable the internal pull-up resistor
  pinMode(4, INPUT_PULLUP);
  pinMode(12, OUTPUT);

}

void loop() {
  //read the pushbutton value into a variable
  int sensorVal = digitalRead(4);
  //print out the value of the pushbutton
  Serial.println(sensorVal);

  // Keep in mind the pull-up means the pushbutton's logic is inverted. It goes
  // HIGH when it's open, and LOW when it's pressed. Turn on pin 13 when the
  // button's pressed, and off when it's not:
  if (sensorVal == HIGH) {
    digitalWrite(12, LOW);
   } else {
    digitalWrite(12, HIGH);
  
  }
}]

IOT relay works as intended with this code. But when I add this line, or any other line referring to the MP3 Shield: nothing occurs. It verifies fine, and complies and uploads fine, but the line or any line referencing the MP3 shield causes the IOT relay to not work. I know that I need to add this line that slows down the MP3 Shield speed, but it will not allow anything further to occur:

//Initialize the MP3 Player Shield and SD card
sd.begin(SD_SEL, SPI_FULL_SPEED);

I can make the Halloween project work without sound, but I’d love to get this prorgam working to include the MP3 shield. Thanks for whatever help you can provide.

Hi halloweenrick.

It looks like you’re trying to use pins for your button and relay that are already in use by the MP3 Shield and code for the shield is conflicting with code for your button and relay.

Try using pins that are not assigned to the shield like any of the analog pins, D5 or D10.

CaptureA.JPG

That was it! Thank you!!! I moved it to pin 10 and its working great!!