Chris Styles
/
SpeakerSquareWave
Make a 5kHz square wave on a speaker
main.cpp@0:47a389265863, 2010-09-13 (annotated)
- Committer:
- chris
- Date:
- Mon Sep 13 13:54:39 2010 +0000
- Revision:
- 0:47a389265863
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:47a389265863 | 1 | #include "mbed.h" |
chris | 0:47a389265863 | 2 | |
chris | 0:47a389265863 | 3 | DigitalOut speaker(p18); |
chris | 0:47a389265863 | 4 | |
chris | 0:47a389265863 | 5 | int main() { |
chris | 0:47a389265863 | 6 | while (1) { |
chris | 0:47a389265863 | 7 | speaker = !speaker; |
chris | 0:47a389265863 | 8 | wait (0.0001); // 5kHz |
chris | 0:47a389265863 | 9 | } |
chris | 0:47a389265863 | 10 | } |