{"id":2153,"date":"2021-06-18T10:26:30","date_gmt":"2021-06-18T02:26:30","guid":{"rendered":"http:\/\/mgspace.wiki\/docs\/?post_type=docs&#038;p=2153"},"modified":"2021-06-18T10:27:49","modified_gmt":"2021-06-18T02:27:49","slug":"mp3%e6%a8%a1%e5%9d%97","status":"publish","type":"docs","link":"http:\/\/mgspace.wiki\/docs\/?docs=mp3%e6%a8%a1%e5%9d%97","title":{"rendered":"mp3\u6a21\u5757"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"483\" height=\"291\" src=\"http:\/\/mgspace.wiki\/docs\/wp-content\/uploads\/2021\/06\/image-52.png\" alt=\"\" class=\"wp-image-2154\"\/><\/figure><\/div>\n\n\n\n<p><strong>DFPlayer Mini\u662f\u4e00\u6b3e\u5c0f\u5de7\u4e14\u4ef7\u683c\u4f4e\u5ec9\u7684MP3\u6a21\u5757\uff0c\u53ef\u4ee5\u76f4\u63a5\u63a5\u9a73\u626c\u58f0\u5668\u3002\u6a21\u5757\u914d\u5408\u4f9b\u7535\u7535\u6c60\u3001\u626c\u58f0\u5668\u3001\u6309\u952e\u53ef\u4ee5\u5355\u72ec\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u4e32\u53e3\u63a7\u5236\uff0c\u4f5c\u4e3aAr UNO\u6216\u8005\u662f\u4efb\u4f55\u6709\u4e32\u53e3\u7684\u5355\u7247\u673a\u7684\u4e00\u4e2a\u6a21\u5757\u3002\u6a21\u5757\u6709\u96c6\u6210\u4e86MP3\u3001WAV\u3001WMA\u7684\u786c\u89e3\u7801\u3002\u540c\u65f6\u8f6f\u4ef6\u652f\u6301TF\u5361\u9a71\u52a8\uff0c\u652f\u6301FAT16\u3001FAT32\u6587\u4ef6\u7cfb\u7edf\u3002\u901a\u8fc7\u7b80\u5355\u7684\u4e32\u53e3\u6307\u4ee4\u5373\u53ef\u5b8c\u6210\u64ad\u653e\u6307\u5b9a\u7684\u97f3\u4e50\uff0c\u4ee5\u53ca\u5982\u4f55\u64ad\u653e\u97f3\u4e50\u7b49\u529f\u80fd\uff0c\u65e0\u9700\u7e41\u7410\u7684\u5e95\u5c42\u64cd\u4f5c\uff0c\u4f7f\u7528\u65b9\u4fbf\uff0c\u7a33\u5b9a\u53ef\u9760\u3002<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u6280\u672f\u89c4\u683c<\/strong><\/h2>\n\n\n\n<p><strong>1\u3001\u652f\u6301\u91c7\u6837\u7387(KHz):8\/11.025\/12\/16\/22.05\/24\/32\/44.1\/48<br>2\u300124\u4f4dDAC\u8f93\u51fa\uff0c\u52a8\u6001\u8303\u56f4\u652f\u6301:90dB\uff0c\u4fe1\u566a\u6bd4\u652f\u6301:85dB<br>3\u3001\u5b8c\u5168\u652f\u6301FAT16\u3001FAT32\u6587\u4ef6\u7cfb\u7edf\uff0c\u6700\u5927\u652f\u630132G\u7684TF\u5361\uff0c\u652f\u630132G\u7684U\u76d8\u300164M\u5b57\u8282\u7684NORFLASH<br>4\u3001\u591a\u79cd\u63a7\u5236\u6a21\u5f0f\u53ef\u9009\u3002IO\u63a7\u5236\u6a21\u5f0f\u3001\u4e32\u53e3\u6a21\u5f0f\u3001AD\u6309\u952e\u63a7\u5236\u6a21\u5f0f<br>5\u3001\u5e7f\u64ad\u8bed\u63d2\u64ad\u529f\u80fd\uff0c\u53ef\u4ee5\u6682\u505c\u6b63\u5728\u64ad\u653e\u7684\u80cc\u666f\u97f3\u4e50\u3002\u5e7f\u544a\u64ad\u653e\u5b8c\u6bd5\u56de\u5230\u80cc\u666f\u97f3\u7ee7\u7eed\u64ad\u653e<br>6\u3001\u97f3\u9891\u6570\u636e\u6309\u6587\u4ef6\u5939\u6392\u5e8f\uff0c\u6700\u591a\u652f\u6301100\u4e2a\u6587\u4ef6\u5939\uff0c\u6bcf\u9694\u6587\u4ef6\u5939\u53ef\u4ee5\u5206\u914d255\u9996\u66f2\u76ee<br>7\u300130\u7ea7\u97f3\u91cf\u53ef\u8c03\uff0c6\u7ea7EQ\u53ef\u8c03<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u5e94\u7528<\/strong><\/h2>\n\n\n\n<p><strong>1\u3001 \u8f66\u8f7d\u5bfc\u822a\u8bed\u97f3\u64ad\u62a5<br>2\u3001 \u516c\u8def\u8fd0\u8f93\u7a3d\u67e5\u3001\u6536\u8d39\u7ad9\u8bed\u97f3\u63d0\u793a<br>3\u3001 \u706b\u8f66\u7ad9\u3001\u6c7d\u8f66\u7ad9\u5b89\u5168\u68c0\u67e5\u8bed\u97f3\u63d0\u793a<br>4\u3001 \u7535\u529b\u3001\u901a\u4fe1\u3001\u91d1\u878d\u8425\u4e1a\u5385\u8bed\u97f3\u63d0\u793a<br>5\u3001 \u8f66\u8f86\u8fdb\u3001\u51fa\u901a\u9053\u9a8c\u8bc1\u8bed\u97f3\u63d0\u793a<br>6\u3001 **\u8fb9\u9632\u68c0\u67e5\u901a\u9053\u8bed\u97f3\u63d0\u793a<br>7\u3001 \u591a\u8def\u8bed\u97f3\u544a\u8b66\u6216\u8bbe\u5907\u64cd\u4f5c\u5f15\u5bfc\u8bed\u97f3<br>8\u3001 \u7535\u52a8\u89c2\u5149\u8f66\u5b89\u5168\u884c\u9a76\u8bed\u97f3\u544a\u793a<br>9\u3001 \u673a\u7535\u8bbe\u5907\u6545\u969c\u81ea\u52a8\u62a5\u8b66<br>10\u3001\u6d88\u9632\u8bed\u97f3\u62a5\u8b66\u63d0\u793a<br>11\u3001\u81ea\u52a8\u5e7f\u64ad\u8bbe\u5907\uff0c\u5b9a\u65f6\u64ad\u62a5<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7a0b\u5e8f\u793a\u4f8b<\/h2>\n\n\n\n<p>\u6bcf\u4e09\u79d2\u66f4\u6362\u4e00\u9996\u6b4c<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/***************************************************\nDFPlayer - A Mini MP3 Player For Arduino\n &lt;https:\/\/www.dfrobot.com\/index.php?route=product\/product&amp;product_id=1121>\n\n ***************************************************\n This example shows the basic function of library for DFPlayer.\n\n Created 2016-12-07\n By [Angelo qiao](Angelo.qiao@dfrobot.com)\n\n GNU Lesser General Public License.\n See &lt;http:\/\/www.gnu.org\/licenses\/> for details.\n All above must be included in any redistribution\n ****************************************************\/\n\n\/***********Notice and Trouble shooting***************\n 1.Connection and Diagram can be found here\n &lt;https:\/\/www.dfrobot.com\/wiki\/index.php\/DFPlayer_Mini_SKU:DFR0299#Connection_Diagram>\n 2.This code is tested on Arduino Uno, Leonardo, Mega boards.\n ****************************************************\/\n\n#include \"Arduino.h\"\n#include \"SoftwareSerial.h\"\n#include \"DFRobotDFPlayerMini.h\"\n\nSoftwareSerial mySoftwareSerial(10, 11); \/\/ RX, TX\nDFRobotDFPlayerMini myDFPlayer;\nvoid printDetail(uint8_t type, int value);\n\nvoid setup()\n{\n  mySoftwareSerial.begin(9600);\n  Serial.begin(115200);\n\n  Serial.println();\n  Serial.println(F(\"DFRobot DFPlayer Mini Demo\"));\n  Serial.println(F(\"Initializing DFPlayer ... (May take 3~5 seconds)\"));\n\n  if (!myDFPlayer.begin(mySoftwareSerial)) {  \/\/Use softwareSerial to communicate with mp3.\n    Serial.println(F(\"Unable to begin:\"));\n    Serial.println(F(\"1.Please recheck the connection!\"));\n    Serial.println(F(\"2.Please insert the SD card!\"));\n    while(true);\n  }\n  Serial.println(F(\"DFPlayer Mini online.\"));\n\n  myDFPlayer.volume(10);  \/\/Set volume value. From 0 to 30\n  myDFPlayer.play(1);  \/\/Play the first mp3\n}\n\nvoid loop()\n{\n  static unsigned long timer = millis();\n\n  if (millis() - timer > 3000) {\n    timer = millis();\n    myDFPlayer.next();  \/\/Play next mp3 every 3 second.\n  }\n\n  if (myDFPlayer.available()) {\n    printDetail(myDFPlayer.readType(), myDFPlayer.read()); \/\/Print the detail message from DFPlayer to handle different errors and states.\n  }\n}\n\nvoid printDetail(uint8_t type, int value){\n  switch (type) {\n    case TimeOut:\n      Serial.println(F(\"Time Out!\"));\n      break;\n    case WrongStack:\n      Serial.println(F(\"Stack Wrong!\"));\n      break;\n    case DFPlayerCardInserted:\n      Serial.println(F(\"Card Inserted!\"));\n      break;\n    case DFPlayerCardRemoved:\n      Serial.println(F(\"Card Removed!\"));\n      break;\n    case DFPlayerCardOnline:\n      Serial.println(F(\"Card Online!\"));\n      break;\n    case DFPlayerPlayFinished:\n      Serial.print(F(\"Number:\"));\n      Serial.print(value);\n      Serial.println(F(\" Play Finished!\"));\n      break;\n    case DFPlayerError:\n      Serial.print(F(\"DFPlayerError:\"));\n      switch (value) {\n        case Busy:\n          Serial.println(F(\"Card not found\"));\n          break;\n        case Sleeping:\n          Serial.println(F(\"Sleeping\"));\n          break;\n        case SerialWrongStack:\n          Serial.println(F(\"Get Wrong Stack\"));\n          break;\n        case CheckSumNotMatch:\n          Serial.println(F(\"Check Sum Not Match\"));\n          break;\n        case FileIndexOut:\n          Serial.println(F(\"File Index Out of Bound\"));\n          break;\n        case FileMismatch:\n          Serial.println(F(\"Cannot Find File\"));\n          break;\n        case Advertise:\n          Serial.println(F(\"In Advertise\"));\n          break;\n        default:\n          break;\n      }\n      break;\n    default:\n      break;\n  }\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>DFPlayer Mini\u662f\u4e00\u6b3e\u5c0f\u5de7\u4e14\u4ef7\u683c\u4f4e\u5ec9\u7684MP3\u6a21\u5757\uff0c\u53ef\u4ee5\u76f4\u63a5\u63a5\u9a73\u626c\u58f0\u5668\u3002\u6a21\u5757\u914d\u5408\u4f9b\u7535\u7535\u6c60\u3001\u626c\u58f0\u5668\u3001\u6309\u952e &hellip; <a href=\"http:\/\/mgspace.wiki\/docs\/?docs=mp3%e6%a8%a1%e5%9d%97\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cmp3\u6a21\u5757\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[34],"doc_tag":[],"class_list":["post-2153","docs","type-docs","status-publish","hentry","doc_category-coding"],"_links":{"self":[{"href":"http:\/\/mgspace.wiki\/docs\/index.php?rest_route=\/wp\/v2\/docs\/2153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/mgspace.wiki\/docs\/index.php?rest_route=\/wp\/v2\/docs"}],"about":[{"href":"http:\/\/mgspace.wiki\/docs\/index.php?rest_route=\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"http:\/\/mgspace.wiki\/docs\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/mgspace.wiki\/docs\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2153"}],"version-history":[{"count":3,"href":"http:\/\/mgspace.wiki\/docs\/index.php?rest_route=\/wp\/v2\/docs\/2153\/revisions"}],"predecessor-version":[{"id":2157,"href":"http:\/\/mgspace.wiki\/docs\/index.php?rest_route=\/wp\/v2\/docs\/2153\/revisions\/2157"}],"wp:attachment":[{"href":"http:\/\/mgspace.wiki\/docs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2153"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"http:\/\/mgspace.wiki\/docs\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_category&post=2153"},{"taxonomy":"doc_tag","embeddable":true,"href":"http:\/\/mgspace.wiki\/docs\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_tag&post=2153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}