Go Down

Topic: Need help! (first time with Arduino) (Read 798 times) previous topic - next topic

ultra_star_uk

Hi as my first time ive come to a problem im unable to fix myself i will leave the error and code below.

i was trying a way to get sound playing on my arduino nano and i think i have everything wired correctley as i found a post online with the code and a quick log on how to use it but after following the instructions im it comes up with this error.

Arduino: 1.8.2 (Windows 7), Board: "Arduino/Genuino Uno"

C:\Users\Harry\AppData\Local\Temp\Temp1_SimpleSDAudio_V1.03.zip\SimpleSDAudio\examples\BareMinimumWithDebug\BareMinimumWithDebug.ino:27:27: fatal error: SimpleSDAudio.h: No such file or directory

 #include <SimpleSDAudio.h>

                           ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


(link to the place i found the code look in description for more:  https://www.youtube.com/watch?v=XgKXwTjAgXM)



code:
/*
 Simple SD Audio bare minimum example, plays file EXAMPLE.AFM from root folder of SD card.
 
 This example shows how to use the SimpleSDAudio library for audio playback.
 You need:
 - An Arduino with ATmega368 or better
 - An SD-Card connected to Arduinos SPI port (many shields will do)
   -> copy EXAMPLE.AFM on freshly formated SD card into root folder
 - A passive loudspeaker and resistor or better: active speakers (then stereo output will be possible)
 
 Audio signal output is at the following pin:
 - Arduino with ATmega328       (many non-mega Arduinos): Pin 9
 - Arduino with ATmega1280/2560 (many mega Arduinos)    : Pin 44
 
 Using passive speaker:   
    Audio-Pin --- -[100 Ohm resistor]- ---- Speaker ---- GND
   
 Using amplifier / active speaker / line-in etc.:
    Audio-Pin --||--------------[10k resistor]----+----[1k resistor]---- GND
              100nF capacitor                   to amp
 
 See SimpleSDAudio.h or our website for more information:
 http://www.hackerspace-ffm.de/wiki/index.php?title=SimpleSDAudio
 
 created  20 Jan 2013 by Lutz Lisseck
 */
#include <SimpleSDAudio.h>

void setup()
{
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // Using F("...") to avoid wasting RAM 
  Serial.print(F("\nInitializing SD card...")); 
 
  // If your SD card CS-Pin is not at Pin 4, enable and adapt the following line:
  // SdPlay.setSDCSPin(10);
 
  if (!SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO | SSDA_MODE_AUTOWORKER)) {
    Serial.println(F("initialization failed. Things to check:"));
    Serial.println(F("* is a card is inserted?"));
    Serial.println(F("* Is your wiring correct?"));
    Serial.println(F("* maybe you need to change the chipSelect pin to match your shield or module?"));
    Serial.print(F("Error code: "));
    Serial.println(SdPlay.getLastError());
    while(1);
  } else {
   Serial.println(F("Wiring is correct and a card is present."));
  }

  Serial.print(F("Looking for EXAMPLE.AFM... "));
  if(!SdPlay.setFile("EXAMPLE.AFM")) {
    Serial.println(F(" not found on card! Error code: "));
    Serial.println(SdPlay.getLastError());
    while(1);
  } else {
   Serial.println(F("found."));
  }   

  Serial.print(F("Playing... "));
  SdPlay.play();
  while(!SdPlay.isStopped()) {
    ;   // no worker needed anymore :-)
  }
  Serial.println(F("done."));
  SdPlay.deInit();
}


void loop(void) {

}

CrossRoads

Do you have the library SimpleSDAudio.h in your /libraries folder?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

ultra_star_uk

i do now... on a new error after a bit of tinkering. :S
Arduino: 1.8.2 (Windows 7), Board: "Arduino/Genuino Uno"

C:\Users\Harry\Documents\Arduino\libraries\SimpleSDAudio\examples\BareMinimumWithDebug\BareMinimumWithDebug.ino: In function 'void setup()':

C:\Users\Harry\Documents\Arduino\libraries\SimpleSDAudio\examples\BareMinimumWithDebug\BareMinimumWithDebug.ino:56:35: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

   if(!SdPlay.setFile("EXAMPLE.AFM")) {

                                   ^

Sketch uses 7168 bytes (22%) of program storage space. Maximum is 32256 bytes.
Global variables use 299 bytes (14%) of dynamic memory, leaving 1749 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x56
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x56
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Grumpy_Mike

The IDE is trying to load the code into your Arduino but the Arduino is not answering. This could be due to a faulty Arduino or you not selecting the right port in the tools menu.

Go Up