Okā¦
I have struck a problem with positioning the āplayheadā within a file. What happens is when I try to play a file from a time bigger than 255 seconds from the start of the file it moves back to the start of the file as if 255 (a byte?) is a limit even though the functions are supposed to be uint16_t !! I wrote a simplified test code which plays at various positions through a file in jumps of 20 seconds. When I get past 255 ish it starts from the beginning again. See the data at the bottom.
I am using an Arduino Nano clone to control the DFPLayer Pro
Code and data belowā¦
/*
Night Time Podcast Player - Testing
*/
#include <EEPROM.h>
#include <DFRobot_DF1201S.h>
#include <SoftwareSerial.h>
SoftwareSerial DF1201SSerial(2, 3); //RX TX
DFRobot_DF1201S DF1201S;
uint16_t count = 0;
// ========== Set Up ==============
void setup(void) {
//Serial Monitor
Serial.begin(9600);
//DF1201S Serial
DF1201SSerial.begin(115200);
while (!DF1201S.begin(DF1201SSerial)) {
Serial.println("Init failed, please check the wire connection!");
delay(1000);
}
// ---- Setup Player ------------------------
/*Set volume*/
DF1201S.setVol(1);
/*Enter music mode*/
DF1201S.switchFunction(DF1201S.MUSIC);
/*Set playback mode to "repeat all"*/
// DF1201S.setPlayMode(DF1201S.SINGLE);
Serial.println();
}
void loop() {
//set file number
DF1201S.playFileNum(2);
DF1201S.setPlayTime(count * 20);
Serial.print(count * 20);
Serial.print(",");
delay(1000);
uint16_t playTime = DF1201S.getCurTime();
Serial.println(playTime);
count++;
DF1201S.pause();
delay(500);
}
Data in seconds from running the code
setPlayTime, getCurTime
0,1
20,20
40,40
60,60
80,80
100,100
120,120
140,140
160,159
180,179
200,199
220,219
240,239
260,5
280,24
300,44
320,64
340,84
360,104
380,124
400,144
420,163
440,183
460,203
480,223
500,943
520,9
540,28
Any insights would be much appreciated.