“音乐播放”的版本间的差异
来自Labplus盛思维基百科
Tangliufeng(讨论 | 贡献) |
Tangliufeng(讨论 | 贡献) (→使用教程) |
||
第25行: | 第25行: | ||
== 使用教程 == | == 使用教程 == | ||
− | 串口连接波特率9600bps | + | 串口连接波特率9600bps<br /> |
+ | MP3驱动使用SoftwareSerial,可自定义串口引脚<br /> | ||
+ | |||
[http://wiki.labplus.cn/images/2/27/Mp3_KT540BPrj.zip MP3_SoftSerial驱动下载] | [http://wiki.labplus.cn/images/2/27/Mp3_KT540BPrj.zip MP3_SoftSerial驱动下载] | ||
=== <small>Arduino示例</small> === | === <small>Arduino示例</small> === |
2018年1月11日 (四) 10:13的版本
概述
MP3播放模块,可通串口发送指令操控播放TF卡中保存的歌曲
技术参数
- 工作电压: VCC 3.3V -5V
- 串口通信
- 采用TF卡存储歌曲或语音信息
- 输出功率3W
- 板载双声道功放,可驱动0.5W喇叭
- 模块尺寸:24x46x7.5mm
引脚定义
VCC | 电源 |
RXI | 串口接收 |
TXD | 串口发送 |
GND | 地 |
使用教程
串口连接波特率9600bps
MP3驱动使用SoftwareSerial,可自定义串口引脚
Arduino示例
#include "kt540b.h" Kt540bClass mp3Play(5,6); //实例化对象,定义pin5为RX,pin6为TX void setup() { mp3Play.begin(); //mp3初始化开始 mp3Play.setVolume(50); //音量设置 mp3Play.play(1); //播放第1首歌曲 delay(10000); //等待,让其播放10秒 } void loop() { mp3Play.pause(); //歌曲暂停 mp3Play.playNext(); //播放下首歌曲 delay(10000); //等待,让其播放10秒 mp3Play.stop(); //停止播放歌曲 }