Skip to content

Commit 2e7652b

Browse files
committed
Add volume up and down functions
1 parent 4822385 commit 2e7652b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ print(df.get_files_in_folder(4))
8282
- set the volume of the module.
8383
- vol: Volume of the module. The range is 0 to 30. The DFPlayer doesn't remember these settings
8484

85+
```volume_up()```
86+
- increase the volume by 1 up to the maximum of 30.
87+
88+
```volume_up()```
89+
- decrease the volume by 1 down to the minimum of 1.
90+
8591
```get_volume()```
8692
- returns the current volume setting of the module or -1 on communication error
8793

src/dfplayer/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ def play(self,folder,file):
6060

6161
def volume(self,vol):
6262
self.send_cmd(6,0,vol)
63+
64+
def volume_up(self):
65+
self.send_cmd(4,0,0)
66+
67+
def volume_down(self):
68+
self.send_cmd(5,0,0)
6369

6470
def reset(self):
6571
self.send_cmd(12,0,1)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy