Skip to main content

Python3 library for the DFPlayer-mini

Project description

DFPlayer

Python3 library for the DFPlayer Mini MP3 Module, works with USB to TTL.

Main interface

Installation

pip install DFPlayer

Usage

from DFPlayer import DFPlayer

serial_device = '/dev/ttyUSB0' # on Windows OS use COMX, example 'COM5'
df = DFPlayer(serial_device)

df.num_files() # get number of files on the SD card
df.play(1) # play a song by a specific number of files, without argument play the first song
df.random() # play random song
df.next() # play next song
df.previous() # play previous song
df.pause() # pause played song
df.stop() # stop played song
df.loop() # loop current played song
df.loop_all() # loop all songs on the SD card
df.set_volume(60) # set volume to 60%, default is 50
df.get_volume() # get current audio volume
df.set_eq(DFPlayer.EQ_NORMAL) # set equalizer to (EQ_NORMAL, EQ_POP, EQ_ROCK, EQ_JAZZ, EQ_CLASSIC, EQ_BASS), default is EQ_NORMAL
df.get_eq() # get current equalizer
df.reset() # reset the module

Test

Make sure the module has an SD card installed and has a minimum of three songs inside. Connect with USB to TTL.

pip install -r requirements.txt
python3 -m unittest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dfplayer-0.1.2.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

DFPlayer-0.1.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file dfplayer-0.1.2.tar.gz.

File metadata

  • Download URL: dfplayer-0.1.2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for dfplayer-0.1.2.tar.gz
Algorithm Hash digest
SHA256 03991c1f4941afdc8ec08bbe9dad8db382ae6a30e772c99290faf4b4db60cc7c
MD5 8fff322ed2ca457f2318c4c8b6d9d6f6
BLAKE2b-256 440d0d3d5b6bf4d979bef14a33db249da09471aeadfa6e1a027147f303be041b

See more details on using hashes here.

File details

Details for the file DFPlayer-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: DFPlayer-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for DFPlayer-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fa17f5a4be4ebd57788a395d2f893f570277a3652277146ea670e3b7b0dcdc1d
MD5 d88f068fde4236191f7722cc58dd3e34
BLAKE2b-256 90ba8ae70304d0334e24e4ffb96625cd47630c9ad785d9384438bd37b8e75792

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page