32 #ifndef JQ6500Serial_h
33 #define JQ6500Serial_h
36 #define MP3_EQ_NORMAL 0
40 #define MP3_EQ_CLASSIC 4
43 #define MP3_SRC_SDCARD 1
44 #define MP3_SRC_BUILTIN 4
55 #define MP3_LOOP_ALL 0
56 #define MP3_LOOP_FOLDER 1
57 #define MP3_LOOP_ONE 2
58 #define MP3_LOOP_RAM 3
59 #define MP3_LOOP_ONE_STOP 4
60 #define MP3_LOOP_NONE 4
62 #define MP3_STATUS_STOPPED 0
63 #define MP3_STATUS_PLAYING 1
64 #define MP3_STATUS_PAUSED 2
75 #define MP3_STATUS_CHECKS_IN_AGREEMENT 4
381 void sendCommand(
byte command,
byte arg1,
byte arg2,
char *responseBuffer,
unsigned int bufferLength);
386 void sendCommand(
byte command,
byte arg1,
byte arg2);
400 unsigned int getVersion();
402 int waitUntilAvailable(
unsigned long maxWaitTime = 1000);
406 static const uint8_t MP3_CMD_BEGIN = 0x7E;
407 static const uint8_t MP3_CMD_END = 0xEF;
409 static const uint8_t MP3_CMD_PLAY = 0x0D;
410 static const uint8_t MP3_CMD_PAUSE = 0x0E;
411 static const uint8_t MP3_CMD_NEXT = 0x01;
412 static const uint8_t MP3_CMD_PREV = 0x02;
413 static const uint8_t MP3_CMD_PLAY_IDX = 0x03;
415 static const uint8_t MP3_CMD_NEXT_FOLDER = 0x0F;
416 static const uint8_t MP3_CMD_PREV_FOLDER = 0x0F;
418 static const uint8_t MP3_CMD_PLAY_FILE_FOLDER = 0x12;
420 static const uint8_t MP3_CMD_VOL_UP = 0x04;
421 static const uint8_t MP3_CMD_VOL_DN = 0x05;
422 static const uint8_t MP3_CMD_VOL_SET = 0x06;
424 static const uint8_t MP3_CMD_EQ_SET = 0x07;
425 static const uint8_t MP3_CMD_LOOP_SET = 0x11;
426 static const uint8_t MP3_CMD_SOURCE_SET = 0x09;
427 static const uint8_t MP3_CMD_SLEEP = 0x0A;
428 static const uint8_t MP3_CMD_RESET = 0x0C;
430 static const uint8_t MP3_CMD_STATUS = 0x42;
431 static const uint8_t MP3_CMD_VOL_GET = 0x43;
432 static const uint8_t MP3_CMD_EQ_GET = 0x44;
433 static const uint8_t MP3_CMD_LOOP_GET = 0x45;
434 static const uint8_t MP3_CMD_VER_GET = 0x46;
436 static const uint8_t MP3_CMD_COUNT_SD = 0x47;
437 static const uint8_t MP3_CMD_COUNT_MEM = 0x49;
438 static const uint8_t MP3_CMD_COUNT_FOLDERS = 0x53;
439 static const uint8_t MP3_CMD_CURRENT_FILE_IDX_SD = 0x4B;
440 static const uint8_t MP3_CMD_CURRENT_FILE_IDX_MEM = 0x4D;
442 static const uint8_t MP3_CMD_CURRENT_FILE_POS_SEC = 0x50;
443 static const uint8_t MP3_CMD_CURRENT_FILE_LEN_SEC = 0x51;
444 static const uint8_t MP3_CMD_CURRENT_FILE_NAME = 0x52;
Definition: JQ6500_Serial.h:80
void prev()
Play the previous file.
Definition: JQ6500_Serial.cpp:58
void nextFolder()
Play the next folder.
Definition: JQ6500_Serial.cpp:68
void next()
Play the next file.
Definition: JQ6500_Serial.cpp:53
void sleep()
Put the device to sleep.
Definition: JQ6500_Serial.cpp:113
byte getStatus()
Get the status from the device.
Definition: JQ6500_Serial.cpp:125
void playFileNumberInFolderNumber(unsigned int folderNumber, unsigned int fileNumber)
Play a specific file in a specific folder based on the name of those folder and file.
Definition: JQ6500_Serial.cpp:78
void currentFileName(char *buffer, unsigned int bufferLength)
Get the name of the "current" file on the SD Card.
Definition: JQ6500_Serial.cpp:190
byte getVolume()
Get the current volume level.
Definition: JQ6500_Serial.cpp:144
unsigned int countFolders(byte source)
Count the number of folders on the specified media.
Definition: JQ6500_Serial.cpp:163
void volumeDn()
Decrease the volume by 1 (volume ranges 0 to 30).
Definition: JQ6500_Serial.cpp:88
void setVolume(byte volumeFrom0To30)
Set the volume to a specific level (0 to 30).
Definition: JQ6500_Serial.cpp:93
void sendCommand(byte command, byte arg1, byte arg2, char *responseBuffer, unsigned int bufferLength)
Send a command to the JQ6500 module,.
Definition: JQ6500_Serial.cpp:219
void reset()
Reset the device (softly).
Definition: JQ6500_Serial.cpp:118
byte getLoopMode()
Get loop mode.
Definition: JQ6500_Serial.cpp:146
unsigned int countFiles(byte source)
Count the number of files on the specified media.
Definition: JQ6500_Serial.cpp:149
void volumeUp()
Increase the volume by 1 (volume ranges 0 to 30).
Definition: JQ6500_Serial.cpp:83
unsigned int currentFileIndexNumber(byte source)
For the currently playing (or paused, or file that would be played next if stopped) file,...
Definition: JQ6500_Serial.cpp:173
void restart()
Restart the current (possibly paused) track from the beginning.
Definition: JQ6500_Serial.cpp:38
byte getEqualizer()
Get the equalizer mode.
Definition: JQ6500_Serial.cpp:145
unsigned int sendCommandWithUnsignedIntResponse(byte command)
Send a command to the JQ6500 module, and get a response.
Definition: JQ6500_Serial.cpp:197
void setLoopMode(byte loopMode)
Set the looping mode.
Definition: JQ6500_Serial.cpp:103
JQ6500_Serial(Stream *dev)
Create JQ6500 object.
Definition: JQ6500_Serial.h:111
void playFileByIndexNumber(unsigned int fileNumber)
Play a specific file based on it's (FAT table) index number.
Definition: JQ6500_Serial.cpp:63
unsigned int currentFileLengthInSeconds()
For the currently playing or paused file, return the total length of the file in seconds.
Definition: JQ6500_Serial.cpp:188
void prevFolder()
Play the previous folder.
Definition: JQ6500_Serial.cpp:73
void setEqualizer(byte equalizerMode)
Set the equalizer to one of 6 preset modes.
Definition: JQ6500_Serial.cpp:98
void pause()
Pause the current file.
Definition: JQ6500_Serial.cpp:48
unsigned int currentFilePositionInSeconds()
For the currently playing or paused file, return the current position in seconds.
Definition: JQ6500_Serial.cpp:187
void play()
Start playing the current file.
Definition: JQ6500_Serial.cpp:33
void setSource(byte source)
Set the source to read mp3 data from.
Definition: JQ6500_Serial.cpp:108