A sawtooth waveform generator using analog output, with smoothness setting over potentiometer.
Dependencies: mbed
main.cpp
- Committer:
- tbjazic
- Date:
- 2014-12-18
- Revision:
- 1:91e1f50eac98
- Parent:
- 0:0713d899de2b
File content as of revision 1:91e1f50eac98:
#include "mbed.h" AnalogOut out(p18); AnalogIn pot1(p19); int main() { int numberOfPoints; while(1) { numberOfPoints = 10 + pot1 * 40; // 10 to 50 points for (int i = 0; i < numberOfPoints; i++) { out = (float) i / numberOfPoints; wait_us(10000/numberOfPoints); } } }