Chris Styles
/
SpeakerSawWave
Generate a 5kHz Saw Tooth wave, with 10 steps per cycle
main.cpp@0:162f44036057, 2010-09-13 (annotated)
- Committer:
- chris
- Date:
- Mon Sep 13 14:05:22 2010 +0000
- Revision:
- 0:162f44036057
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:162f44036057 | 1 | #include "mbed.h" |
chris | 0:162f44036057 | 2 | |
chris | 0:162f44036057 | 3 | AnalogOut speaker(p18); |
chris | 0:162f44036057 | 4 | |
chris | 0:162f44036057 | 5 | int main() { |
chris | 0:162f44036057 | 6 | while (1) { |
chris | 0:162f44036057 | 7 | for (float i = 0.0 ; i <= 1.0 ; i += 0.1 ) { |
chris | 0:162f44036057 | 8 | speaker = i; |
chris | 0:162f44036057 | 9 | wait (0.00001); // 5kHz, with 10 steps |
chris | 0:162f44036057 | 10 | } |
chris | 0:162f44036057 | 11 | } |
chris | 0:162f44036057 | 12 | } |