Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of NucleoDACSawtooth by
main.cpp
- Committer:
- davolfman
- Date:
- 2017-11-02
- Revision:
- 1:330fb9932926
- Parent:
- 0:36e3fe60f8d1
File content as of revision 1:330fb9932926:
#include "mbed.h" AnalogIn volumeKnob(PA_0); AnalogIn frequencyKnob(PA_1); AnalogOut speakerAmp(PA_4); /*---------------------------------------------------------------------------- MAIN function *----------------------------------------------------------------------------*/ int main(){ double phase; double d_phase; double phase_remainder = 0; //speakerAmp.period_us(4.0); while(true){ d_phase = ((double)frequencyKnob * (double)frequencyKnob * (8000-320) + 320) * 0.000004; for(phase = phase_remainder; phase < 1; phase+= d_phase){ speakerAmp = volumeKnob * phase; wait_us(4.0); } phase_remainder = phase - 1.0; } }