“(SKU:RB-01C048)MP3 Player Shield-Retail擴展版”的版本間的差異

來自ALSROBOT WiKi
跳轉至: 導航、 搜索
 
(未顯示3個用戶的3個中間版本)
第3行: 第3行:
 
2013年哈爾濱奧松機器人科技有限公司正式成為美國第一大電子開源硬件巨頭公司Sparkfun中國區(qū)域總代理。此款MP3播放器擴展板為Sparkfun原裝進口,它可以有效地將任何一款Arduino變?yōu)橐粋€功能完整的獨立的MP3播放器!
 
2013年哈爾濱奧松機器人科技有限公司正式成為美國第一大電子開源硬件巨頭公司Sparkfun中國區(qū)域總代理。此款MP3播放器擴展板為Sparkfun原裝進口,它可以有效地將任何一款Arduino變?yōu)橐粋€功能完整的獨立的MP3播放器!
 
==規(guī)格參數(shù)==
 
==規(guī)格參數(shù)==
 +
* 音頻接口:3.5mm
 +
* 存儲:micro SD卡
 +
* 復位按鍵 * 1個
  
 
==使用方法==
 
==使用方法==
?
電路原理圖
 
?
[[文件:RB-01C0481.jpg|700px|縮略圖|居中]]
 
?
==應用例程==
 
 
建立MP3
 
建立MP3
 
===建立SD卡===
 
===建立SD卡===
 
首先需要重命名您的MP3文件。每九個軌道需要專門命名為“track001。MP3”到“track009 MP3?!薄?/div>
 
首先需要重命名您的MP3文件。每九個軌道需要專門命名為“track001。MP3”到“track009 MP3。”。
?
[[文件:RB-01C0481.jpg|500px|縮略圖|居中]]
+
[[文件:RB-01C0483.jpg|500px|縮略圖|居中]]
 
===連接圖示===
 
===連接圖示===
 
[[文件:RB-01C0482.jpg|500px|縮略圖|居中]]
 
[[文件:RB-01C0482.jpg|500px|縮略圖|居中]]
?
===示例代碼===
+
===例子程序===
 
<pre style='color:blue'>/*
 
<pre style='color:blue'>/*
 
   MP3 Shield Trigger
 
   MP3 Shield Trigger
第141行: 第141行:
 
}</pre>
 
}</pre>
 
===程序效果===
 
===程序效果===
?
播放MP3音樂
+
播放模塊SD卡中儲存的MP3格式音樂
 
==產品相關推薦==
 
==產品相關推薦==
?
購買地址:[http://gharee.com/goods-451.html MP3 Player Shield-Retail擴展版]<br />
+
[[文件:erweima.png|230px|無框|右]]
?
 
+
===購買地址===
?
相關資料1:[http://www.sparkfun.com/mp3player 快速入門指南]<br />
+
[http://gharee.com/goods-451.html MP3 Player Shield-Retail擴展版]<br/>
?
 
+
===周邊產品推薦===
?
相關資料2:[http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Dev/Arduino/Shields/MP3_Player_Example.pde MP3播放器的例子代碼]<br />
+
[http://www.alsrobot.cn/goods-160.html SD卡讀寫模塊]<br/>
?
 
+
[http://gharee.com/goods-562.html SD卡 16G SanDisk閃迪 Class10]<br/>
?
相關資料3:[http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Dev/Arduino/Shields/MP3_Player_Example_Control.pde MP3播放器控制實例]
+
[http://www.alsrobot.cn/goods-546.html Carduino UNO 控制器]<br/>
 +
===相關問題解答===
 +
===相關學習資料===
 +
[https://learn.sparkfun.com/tutorials/mp3-player-shield-hookup-guide-v15?_ga=1.158525693.634126345.1445585435 MP3 Player Shield Hookup Guide V15]<br/>
 +
[https://cdn.sparkfun.com/datasheets/Dev/Arduino/Shields/VS1053B.pdf VS1053B 芯片數(shù)據(jù)手冊]<br/>
 +
[https://cdn.sparkfun.com/datasheets/Dev/Arduino/Shields/MP3%20Shield_v15.pdf MP3 Player Shield-Retail擴展版 PDF 版本電路原理圖]<br/>
 +
[http://www.makerspace.cn/portal.php 奧松機器人技術論壇]<br/>

2015年10月24日 (六) 14:34的最后版本

RB-01C048.jpg

目錄

產品概述

2013年哈爾濱奧松機器人科技有限公司正式成為美國第一大電子開源硬件巨頭公司Sparkfun中國區(qū)域總代理。此款MP3播放器擴展板為Sparkfun原裝進口,它可以有效地將任何一款Arduino變?yōu)橐粋€功能完整的獨立的MP3播放器!

規(guī)格參數(shù)

  • 音頻接口:3.5mm
  • 存儲:micro SD卡
  • 復位按鍵 * 1個

使用方法

建立MP3

建立SD卡

首先需要重命名您的MP3文件。每九個軌道需要專門命名為“track001。MP3”到“track009 MP3。”。

RB-01C0483.jpg

連接圖示

RB-01C0482.jpg

例子程序

/*
  MP3 Shield Trigger
  by: Jim Lindblom
      SparkFun Electronics
  date: September 23, 2013

  This is an example MP3 trigger sketch for the SparkFun MP3 Shield.
  Pins 0, 1, 5, 10, A0, A1, A2, A3, and A4 are setup to trigger tracks
  "track001.mp3", "track002.mp3", etc. on an SD card loaded into
  the shield. Whenever any of those pins are shorted to ground,
  their respective track will start playing.

  When a new pin is triggered, any track currently playing will
  stop, and the new one will start.

  A5 is setup to globally STOP playing a track when triggered.

  If you need more triggers, the shield's jumpers on pins 3 and 4 
  (MIDI-IN and GPIO1) can be cut open and used as additional
  trigger pins. Also, because pins 0 and 1 are used as triggers
  Serial is not available for debugging. Disable those as
  triggers if you want to use serial.

  Much of this code was grabbed from the FilePlayer example
  included with the SFEMP3Shield library. Major thanks to Bill
  Porter and Michael Flaga, again, for this amazing library!
*/

#include <SPI.h>           // SPI library
#include <SdFat.h>         // SDFat Library
#include <SdFatUtil.h>     // SDFat Util Library
#include <SFEMP3Shield.h>  // Mp3 Shield Library

SdFat sd; // Create object to handle SD functions

SFEMP3Shield MP3player; // Create Mp3 library object
// These variables are used in the MP3 initialization to set up
// some stereo options:
const uint8_t volume = 0; // MP3 Player volume 0=max, 255=lowest (off)
const uint16_t monoMode = 1;  // Mono setting 0=off, 3=max

/* Pin setup */
#define TRIGGER_COUNT 9
int triggerPins[TRIGGER_COUNT] = {0, 1, 5, 10, A0, A1, A2, A3, A4};
int stopPin = A5; // This pin triggers a track stop.
int lastTrigger = 0; // This variable keeps track of which tune is playing

void setup()
{
  /* Set up all trigger pins as inputs, with pull-ups activated: */
  for (int i=0; i<TRIGGER_COUNT; i++)
  {
    pinMode(triggerPins[i], INPUT_PULLUP);
  }
  pinMode(stopPin, INPUT_PULLUP);

  initSD();  // Initialize the SD card
  initMP3Player(); // Initialize the MP3 Shield
}

// All the loop does is continuously step through the trigger
//  pins to see if one is pulled low. If it is, it'll stop any
//  currently playing track, and start playing a new one.
void loop()
{
  for (int i=0; i<TRIGGER_COUNT; i++)
  {
    if ((digitalRead(triggerPins[i]) == LOW) && ((i+1) != lastTrigger))
    {
      lastTrigger = i+1; // Update lastTrigger variable to current trigger
      /* If another track is playing, stop it: */
      if (MP3player.isPlaying())
        MP3player.stopTrack();

      /* Use the playTrack function to play a numbered track: */
      uint8_t result = MP3player.playTrack(lastTrigger);
      // An alternative here would be to use the
      //  playMP3(fileName) function, as long as you mapped
      //  the file names to trigger pins.

      if (result == 0)  // playTrack() returns 0 on success
      {
        // Success
      }
      else // Otherwise there's an error, check the code
      {
        // Print error code somehow, someway
      }
    }
  }
  // After looping through and checking trigger pins, check to
  //  see if the stopPin (A5) is triggered.
  if (digitalRead(stopPin) == LOW)
  {
    lastTrigger = 0; // Reset lastTrigger
    // If another track is playing, stop it.
    if (MP3player.isPlaying())
      MP3player.stopTrack();
  }
}

// initSD() initializes the SD card and checks for an error.
void initSD()
{
  //Initialize the SdCard.
  if(!sd.begin(SD_SEL, SPI_HALF_SPEED)) 
    sd.initErrorHalt();
  if(!sd.chdir("/")) 
    sd.errorHalt("sd.chdir");
}

// initMP3Player() sets up all of the initialization for the
// MP3 Player Shield. It runs the begin() function, checks
// for errors, applies a patch if found, and sets the volume/
// stero mode.
void initMP3Player()
{
  uint8_t result = MP3player.begin(); // init the mp3 player shield
  if(result != 0) // check result, see readme for error codes.
  {
    // Error checking can go here!
  }
  MP3player.setVolume(volume, volume);
  MP3player.setMonoMode(monoMode);
}

程序效果

播放模塊SD卡中儲存的MP3格式音樂

產品相關推薦

Erweima.png

購買地址

MP3 Player Shield-Retail擴展版

周邊產品推薦

SD卡讀寫模塊
SD卡 16G SanDisk閃迪 Class10
Carduino UNO 控制器

相關問題解答

相關學習資料

MP3 Player Shield Hookup Guide V15
VS1053B 芯片數(shù)據(jù)手冊
MP3 Player Shield-Retail擴展版 PDF 版本電路原理圖
奧松機器人技術論壇