Mangolika Bhattacharya
/
app-board-Speaker
test
Fork of app-board-Speaker by
Revision 3:93c2eaf642f1, committed 2014-11-25
- Comitter:
- mangolika
- Date:
- Tue Nov 25 15:44:25 2014 +0000
- Parent:
- 2:cfd337edff08
- Commit message:
- s
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r cfd337edff08 -r 93c2eaf642f1 main.cpp --- a/main.cpp Thu Oct 25 12:25:00 2012 +0000 +++ b/main.cpp Tue Nov 25 15:44:25 2014 +0000 @@ -2,16 +2,37 @@ DigitalIn fire(p14); PwmOut spkr(p26); +Ticker ticker; +DigitalOut led1(LED1); +DigitalOut led2(LED2); +CAN can1(p9, p10); +CAN can2(p30, p29); -int main() -{ - while (1) { - for (float i=2000.0; i<10000.0; i+=100) { - spkr.period(1.0/i); - spkr=0.5; - wait(0.1); +char counter = 0; + void send() { + + + printf("send()\n"); + if(can1.write(CANMessage(50, &counter, 1))) { + printf("wloop()\n"); + counter++; + printf("Message sent: %d\n", counter); + } + led1 = !led1; +} + +int main() { + printf("main()\n"); + ticker.attach(&send, 1); + CANMessage msg; + while(1) { + printf("loop()\n"); + if(can2.read(msg)) { + printf("Message received: %d\n", msg.data[0]); + led2 = !led2; + send(); } - spkr=0.0; - while(!fire) {} - } -} \ No newline at end of file + + + wait(0.2); + }}
diff -r cfd337edff08 -r 93c2eaf642f1 mbed.bld --- a/mbed.bld Thu Oct 25 12:25:00 2012 +0000 +++ b/mbed.bld Tue Nov 25 15:44:25 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/cd19af002ccc \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1 \ No newline at end of file