Trying to send a HIGH signal from an Uno to be recognized by a Nano.
Nano is grounded with Uno.
Nano Vin and Uno Vin from same battery
2.5 Pin 2 of the Nano has a 10k pulldown resistor to ground
I'm measuring a 4.9V trigger from Uno to pin 2 of Nano
I want the Nano to play the file "dalek" when it sees a HIGH from the Uno
Below is the code for the Nano. It plays the "tinman" startup file everytime.
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);
}
}
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?
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.