极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10921|回复: 3

用MANGO II 做MP3时候程序的问题

[复制链接]
发表于 2015-2-14 22:48:08 | 显示全部楼层 |阅读模式
本帖最后由 Sand_man 于 2015-2-15 00:07 编辑

(原教程链接:http://www.geek-workshop.com/thread-2611-1-1.html

基本都是按照这个做的,因为是小白中的小白←←

除了用了一个v4.2的sd card shield扩展模块替代了双排长针和pin线做的简易读卡器(X宝seeed官店购得)

问题出现在导入程序的时候,

下面引用IDE的错误报告:


MostFunctionDemo.ino:28:27: fatal error: SimpleSDAudio.h: No such file or directory
compilation terminated.
编译有误。

尽管我看得懂英文,

但是这个“路径不存在”的问题也是很蛋特ng,因为这个文件尼玛就在我的

E:\Arduino\IDE\libraries\SimpleSDAudio

目录下面......

最后,方便各位大神,附上程序:

/*
Simple SD Audio example, shows the usage of most functions
via terminal at serial communication port.

This example shows how to use the SimpleSDAudio library for audio playback.
You need:
- An Arduino with ATmega168/ATmega368 or better
- An SD-Card connected to Arduinos SPI port (many shields will do)
   -> copy some converted audio files 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 ATmega168/328   (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  29 Jun 2012 by Lutz Lisseck
*/
#include <SimpleSDAudio.h>

// Callback target, prints output to serial
void DirCallback(char *buf) {
  Serial.println(buf);
}

char AudioFileName[16];

// Create static buffer
#define BIGBUFSIZE (2*512)      // bigger than 2*512 is often only possible on Arduino megas!
uint8_t bigbuf[BIGBUFSIZE];

// helper function to determine free ram at runtime
int freeRam () {
  extern int __heap_start, *__brkval;
  int v;
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}

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
  }
  
  Serial.print(F("Free Ram: "));
  Serial.println(freeRam());
  
  // Setting the buffer manually for more flexibility
  SdPlay.setWorkBuffer(bigbuf, BIGBUFSIZE);
  
  Serial.print(F("\nInitializing SimpleSDAudio V" SSDA_VERSIONSTRING " ..."));  
  
  // If your SD card CS-Pin is not at Pin 4, enable and adapt the following line:
  //SdPlay.setSDCSPin(10);
  
  // Select between SSDA_MODE_FULLRATE or SSDA_MODE_HALFRATE (62.5kHz or 31.25kHz)
  // and the output modes SSDA_MODE_MONO_BRIDGE, SSDA_MODE_MONO or SSDA_MODE_STEREO
  if (!SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO)) {
    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."));
  }
  

}


void loop(void) {
  uint8_t count=0, c, flag;
  
  Serial.println(F("Files on card:"));
  SdPlay.dir(&DirCallback);

ReEnter:
  count = 0;
  Serial.println(F("\r\nEnter filename (send newline after input):"));
  do {
    while(!Serial.available()) ;
    c = Serial.read();
    if(c > ' ') AudioFileName[count++] = c;
  } while((c != 0x0d) && (c != 0x0a) && (count < 14));
  AudioFileName[count++] = 0;
  
  Serial.print(F("Looking for file... "));
  if(!SdPlay.setFile(AudioFileName)) {
    Serial.println(F(" not found on card! Error code: "));
    Serial.println(SdPlay.getLastError());
    goto ReEnter;
  } else {
   Serial.println(F("found."));
  }   

  Serial.println(F("Press s for stop, p for play, h for pause, f to select new file, d for deinit, v to view status."));
  flag = 1;
  
  while(flag) {
    SdPlay.worker();
    if(Serial.available()) {
      c = Serial.read();
      switch(c) {
         case 's':
           SdPlay.stop();
           Serial.println(F("Stopped."));
           break;
           
         case 'p':
           SdPlay.play();
           Serial.println(F("Play."));
           break;
           
         case 'h':
           SdPlay.pause();
           Serial.println(F("Pause."));
           break;   
   
         case 'd':
           SdPlay.deInit();
           Serial.println(F("SdPlay deinitialized. You can now safely remove card. System halted."));
           while(1) ;
           break;  
            
         case 'f':
           flag = 0;
           break;
     
         case 'v':
           Serial.print(F("Status: isStopped="));
           Serial.print(SdPlay.isStopped());
           Serial.print(F(", isPlaying="));
           Serial.print(SdPlay.isPlaying());
           Serial.print(F(", isPaused="));
           Serial.print(SdPlay.isPaused());
           Serial.print(F(", isUnderrunOccured="));
           Serial.print(SdPlay.isUnderrunOccured());
           Serial.print(F(", getLastError="));
           Serial.println(SdPlay.getLastError());
           Serial.print(F("Free RAM: "));
           Serial.println(freeRam());
           break;      
      }
    }
  }
  
  
}
回复

使用道具 举报

 楼主| 发表于 2015-2-15 00:09:31 | 显示全部楼层
我反正觉得是#include <SimpleSDAudio.h>有问题。。。。
回复 支持 反对

使用道具 举报

发表于 2015-2-25 23:36:47 | 显示全部楼层
你好像应该用这个方式来添加库,另外,你自己导入的库应该位于 C:\Users\youname\Documents\arduino\libraries\ 下面而不是你放的那个位置。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2015-3-4 22:00:14 | 显示全部楼层
应该是库没有下载并放到指定位置
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-10 10:55 , Processed in 0.037391 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表