Thanks to visit codestin.com
Credit goes to github.com

Skip to content

New volume_up and volume_down functions #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ print(df.get_files_in_folder(4))
- set the volume of the module.
- vol: Volume of the module. The range is 0 to 30. The DFPlayer doesn't remember these settings

```volume_up()```
- increase the volume by 1 up to the maximum of 30.

```volume_down()```
- decrease the volume by 1 down to the minimum of 1.

```get_volume()```
- returns the current volume setting of the module or -1 on communication error

Expand Down
6 changes: 6 additions & 0 deletions src/dfplayer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ def play(self,folder,file):

def volume(self,vol):
self.send_cmd(6,0,vol)

def volume_up(self):
self.send_cmd(4,0,0)

def volume_down(self):
self.send_cmd(5,0,0)

def reset(self):
self.send_cmd(12,0,1)
Expand Down