Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Purpose

Play a tune on the CrcDuino buzzer.

When to use

When you want to play a sound (for debugging).

Where to use

Inside the loop function.

Info

Calling this function cancels the previous sound. Make sure to not call it repeatedly.

Returns

N/A

Main prototype and parameters

Objectif

Joue un mélodie sur le buzzer du CrcDuino.

Quand l’utiliser

Quand vous voulez jouer un son (pour le déverminage).

Où l’utiliser

Dans la fonction loop.

Info

Appeler cette fonction annule le son précédent. Assurez-vous de ne pas l’appeler à répétition.

Valeur de retour

Aucune

Prototype principal et paramètres

void CrcLib::PlayTune(const Note notes[], bool repeat)

The following parameters must be passed to the function for it to work properly:

  • A sequence of notes to play

  • Whether to loop the sound

    Les paramètres suivants sont nécessaires à la fonction:

    • Une séquence de notes à jouer

    • Si le son doit être répété

    Overloads

    void CrcLib::PlayTune(Tune* tune)

    A more advanced version of the function you probably don’t need. If you want to use it, read CrcBuzz.h for more info.

    Examples

    Une version plus avancée de la fonction dont vous n’aurez probablement pas besoin. Si vous voulez l’utiliser, lisez CrcBuzz.h pour plus d’information.

    Exemples

    Expand
    title#1: Play a tuneJouer une mélodie
    Code Block
    languagecpp
    #include <CrcLib.h>
    
    // SeeVoir thela page about Note
    // DefineDéfinissez aune songchanson usingainsi { <duration in <durée de la note en ms>, <fréquence <notede la frequencynote inen Hz> }
    Note notes[] = { { 250, NOTE_B4 }, { 500, NOTE_F5 }, Note::END };
    
    CrcLib::Timer timer;
    void setup() {
        CrcLib::Initialize();
        timer.Start(2000);
    }
    
    void loop() {
        CrcLib::Update();
    
        if (timer.IsFinished()) { // start the tune each 2sdémarrer la mélodie toutes les 2 secondes
            timer.Next();
            CrcLib::PlayTune(notes, false);
        }
    }
    Filter by label (Content by label)
    sorttitle
    excerptTyperich content
    cqllabel = "ar-crclib_funct_utilities"