High from Uno to Nano

Trying to send a HIGH signal from an Uno to be recognized by a Nano.

  1. Nano is grounded with Uno.
  2. Nano Vin and Uno Vin from same battery
    2.5 Pin 2 of the Nano has a 10k pulldown resistor to ground
  3. I'm measuring a 4.9V trigger from Uno to pin 2 of Nano
  4. I want the Nano to play the file "dalek" when it sees a HIGH from the Uno
  5. Below is the code for the Nano. It plays the "tinman" startup file everytime.
  6. Help a brother out
                    //         FOR USE WITH NANO
                    
                    //       Pin 9 speaker
                    //       Pin 10  CS
                    //       Pin 11  MOSI
                    //       Pin 12  MISO
                    //       Pin D13 SCK
                    //       connect SD reader to 5V, not 3.3V    
                   //        Pin D2  is trigger for SD card to read file

#include <SD.h>                      // regular SD library
#define SD_ChipSelectPin 10  // CS  arduino nano 

#include <TMRpcm.h>           //  fancy library from sketchy internet site
int stoptrig = 2;    
TMRpcm tmrpcm;   // create an object for use ip n this sketch
char mychar;
   
void setup(){
         
  tmrpcm.speakerPin = 9; 
  pinMode(stoptrig,INPUT);// trigger from UNO after stopping

  Serial.begin(9600);
  if (!SD.begin(SD_ChipSelectPin)) // see if the card is present and can be initialized
  {  
    Serial.println("SD fail");  
    return;                    // don't do anything more if not
  }
  tmrpcm.play("tinman.wav"); //file "tinman" will play each time the arduino powers up, or is reset
}

void loop(){  
if(digitalRead(stoptrig)==HIGH)  //veritfied as getting 4.9V from UNO
{
  tmrpcm.play("dalek.wav");
  delay (5000);
  
}

}

What happens {A} if you comment out line 31 and {B} if (while un-commented) you change line 31 so it plays dalek.wav

...R

Robin2:
What happens {A} if you comment out line 31 and {B} if (while un-commented) you change line 31 so it plays dalek.wav

...R

A. Comment out line 31 and nothing is read from SD card.
B. Change line 31 to play "dalek.wav" and it plays that file on startup.

OK. Well now we know that dalek.wav actually exists on the SD Card and can be accessed.

I am not very familiar with using an SD Card but my guess is that your program is not properly finding the second file after it has started using the first one. Maybe it needs to search the SD Card again?

...R

I'll try that. Thanks

What happens if you do this?

void loop(){  
if(digitalRead(stoptrig)==HIGH)  //veritfied as getting 4.9V from UNO
{
  Serial.println("Signal received");
  tmrpcm.play("dalek.wav");
  delay (5000);
  
}

Adding Serial.println("Signal received")
Shows up as Signal received in Serial Monitor.

So, the Nano is obviously getting the input. The problem lies somewhere in tmrpcm.play("dalak.wav")

Ya. Here's the weird thing:
When I use
stoptrig=HIGH;
all on its own, instead of using the " if " statement, the "dalek.wav" file plays.

Also, if I use stoptrig=HIGH; giving a HIGH to Pin2 on the Nano,
right before the play dalek.wav it will still not play,

But using the same stoptrig=HIGH; as the first thing after void loop() the dalek file plays.

monkeyknuckler:
But using the same stoptrig=HIGH; as the first thing after void loop() the dalek file plays.

If you want help you need to post the program you are referring to.

...R

Uh, the one at the top of the page.

monkeyknuckler:
Uh, the one at the top of the page.

It can't be that because in Replies #8 and #9 you say that you changed the program.

And please post your latest code in a new Reply. Don't change the code in an earlier Reply.

...R

Thanks for all the input. Was a power issue between Uno and Nano. Had something to do with robot servos controlled by Uno going in reverse and doing something, still not quite sure, to Nano. Works fine now.