Sound : LED = 1:1 param "1" never go upper 15, under 0
Dependencies: C12832 mbed-rtos mbed
Fork of app-board-Speaker by
main.cpp@1:0a08d26b011a, 2012-10-16 (annotated)
- Committer:
- chris
- Date:
- Tue Oct 16 13:26:23 2012 +0000
- Revision:
- 1:0a08d26b011a
- Parent:
- 0:f86c572491c3
- Child:
- 2:cfd337edff08
First commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:f86c572491c3 | 1 | #include "mbed.h" |
chris | 0:f86c572491c3 | 2 | |
chris | 1:0a08d26b011a | 3 | DigitalIn fire(p14); |
chris | 1:0a08d26b011a | 4 | PwmOut spkr(p26); |
chris | 0:f86c572491c3 | 5 | |
chris | 0:f86c572491c3 | 6 | int main() |
chris | 0:f86c572491c3 | 7 | { |
chris | 1:0a08d26b011a | 8 | for (float i=2000.0; i<10000.0; i+=100) { |
chris | 1:0a08d26b011a | 9 | spkr.period(1.0/i); |
chris | 1:0a08d26b011a | 10 | spkr=0.5; |
chris | 1:0a08d26b011a | 11 | wait(0.1); |
chris | 0:f86c572491c3 | 12 | } |
chris | 1:0a08d26b011a | 13 | spkr=0.0; |
chris | 1:0a08d26b011a | 14 | while(!fire) {} |
chris | 0:f86c572491c3 | 15 | } |