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