A sawtooth waveform generator using analog output, with smoothness setting over potentiometer.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 1:91e1f50eac98
- Parent:
- 0:0713d899de2b
--- a/main.cpp Wed Dec 17 16:35:37 2014 +0000 +++ b/main.cpp Thu Dec 18 07:37:45 2014 +0000 @@ -6,9 +6,9 @@ int main() { int numberOfPoints; while(1) { - numberOfPoints = 10 + pot1 * 90; // 10 to 100 points + numberOfPoints = 10 + pot1 * 40; // 10 to 50 points for (int i = 0; i < numberOfPoints; i++) { - out = i / numberOfPoints; + out = (float) i / numberOfPoints; wait_us(10000/numberOfPoints); } }