テスト
Dependencies: C12832 USBHost mbed MMA7660 wave_player
Fork of app-board-Speaker by
main.cpp@2:cfd337edff08, 2012-10-25 (annotated)
- Committer:
- chris
- Date:
- Thu Oct 25 12:25:00 2012 +0000
- Revision:
- 2:cfd337edff08
- Parent:
- 1:0a08d26b011a
- Child:
- 3:b1115b34e95b
Added an outer loop so that the sweep can be replayed
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 | 2:cfd337edff08 | 8 | while (1) { |
chris | 2:cfd337edff08 | 9 | for (float i=2000.0; i<10000.0; i+=100) { |
chris | 2:cfd337edff08 | 10 | spkr.period(1.0/i); |
chris | 2:cfd337edff08 | 11 | spkr=0.5; |
chris | 2:cfd337edff08 | 12 | wait(0.1); |
chris | 2:cfd337edff08 | 13 | } |
chris | 2:cfd337edff08 | 14 | spkr=0.0; |
chris | 2:cfd337edff08 | 15 | while(!fire) {} |
chris | 0:f86c572491c3 | 16 | } |
chris | 0:f86c572491c3 | 17 | } |