Giter VIP home page Giter VIP logo

volume-control's Introduction

VolumeControl

This library provides a 2-source non-block volume control for DFPlayer mini mp3 module.

Usage

Download ZIP; open Sketch menu and then Include Library -> Manage Libraries -> Add .ZIP Library;
Sketch -> Include Library -> Manage Libraries -> VolumeControl

Libraries guide

#include <VolumeControl.h>

You must declare function with your own setter

void setVolume(int volume)

and pass it to constructor as link.
This function will be called if volume is changed.

In main loop() call void update(unsigned long currentMillis) to check changes and update volume (each timeInterval mills)

See example below.

Использование

Загрузите ZIP, после чего добавьте через меню Скетч -> Подключить библиотеку -> Добавить ZIP библиотеку;
Скетч -> Подключить библиотеку -> VolumeControl

#include <VolumeControl.h>

Объявите функцию регулировки громкости

void setVolume(int volume)

и передайте её в конструктор по ссылке.
При изменении громкости эта функция будет вызвана.

В цикле loop() вызывайте void update(unsigned long currentMillis) для проверки изменений громкости (каждые timeInterval) и установки громкости

Example / Пример

#include <VolumeControl.h>

#define VOL A0

void setVolume(int volume) {
  Serial.println((String)"Volume set to " + volume);
  mp3_set_volume(volume);
}

VolumeControl vc(VOL, 500, &setVolume);

...
void setup() {
...
}

...
void loop() {
  vc.update(millis());
  ...
}

volume-control's People

Contributors

bscheshir avatar bscheshirwork avatar per1234 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

seco

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.