Play one note with frequency [Hz] and fixed duration [s]
play-note
@/play-note
Play one note with frequency [Hz] and fixed duration [s]
PINport
FREQnumber
Sound frequency [Hz]
DURnumber
Sound duration [s]
UPDpulse
To use the node in your project you should have the amperka/colony library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.
C++ implementation
struct State {
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
if (!isInputDirty<input_UPD>(ctx)) return;
auto pin = getValue<input_PIN>(ctx);
auto frequency = getValue<input_FREQ>(ctx);
auto duration = getValue<input_DUR>(ctx);
tone(pin, frequency);
delay(duration*1000);
noTone(pin);
}