cgnuino
Public Member Functions | List of all members
CgnTone Class Reference

Emits asynchroneous tone output in a similar way to CgnDO class. More...

#include <cgnuino.h>

Public Member Functions

 CgnTone (byte)
 Consructor. More...
 
void update ()
 Stop the tone when finished determined time length of output. More...
 
void out (uint32_t, uint16_t=440)
 Starts a tone out from a pin for determined time length. More...
 

Detailed Description

In order to asynchroneously emit digital outputs, cgnuino has CgnDO class dedicated to that purpose. The same demand for tone output instead of digital outputs can be met by CgnTone class. The usage is almost identical to CgnDO class except that CgnTone class only use one out pin, instead of holding multiple digital-out pins. (Usually multiple tone outputs are not required in standard behavioral tasks.) Start beeping a piezo buzzer in a required frequency by out method. Then repeatedly call update method so that it can terminate tone output once a designated time length has passed.

Constructor & Destructor Documentation

CgnTone::CgnTone ( byte  tonePin)
Parameters
tonePinPin number for digital-out to a piezo buzzer.

Member Function Documentation

void CgnTone::out ( uint32_t  toneMs,
uint16_t  toneFreq = 440 
)
Parameters
toneMsTime length of output in [ms].
toneFreqFrequency of tone output in [Hz].
void CgnTone::update ( )
Note
For a normal usage, this method is intended to be called once inside loop function.

The documentation for this class was generated from the following files: