-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMP3.cpp
More file actions
17 lines (16 loc) · 671 Bytes
/
Copy pathMP3.cpp
File metadata and controls
17 lines (16 loc) · 671 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "MP3.h"
SoftwareSerial mp3(ARDUINO_RX, ARDUINO_TX);
void mp3_command(int8_t command, int16_t dat) {
int8_t frame[8] = { 0 };
frame[0] = 0x7e; // starting byte
frame[1] = 0xff; // version
frame[2] = 0x06; // the number of bytes of the command without starting byte and ending byte
frame[3] = command; //
frame[4] = 0x00; // 0x00 = no feedback, 0x01 = feedback
frame[5] = (int8_t)(dat >> 8); // data high byte
frame[6] = (int8_t)(dat); // data low byte
frame[7] = 0xef; // ending byte
for (uint8_t i = 0; i < 8; i++) {
mp3.write(frame[i]);
}
}