It begins

Dependencies:   SDFileSystem mbed-rtos mbed wave_player

Fork of BAT_senior_design by BAT

Committer:
aismail1997
Date:
Fri Oct 13 15:01:03 2017 +0000
Revision:
6:1aa86ad19af9
Child:
9:418a4437a693
rtos failing

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aismail1997 6:1aa86ad19af9 1 #include "wave_player.h"
aismail1997 6:1aa86ad19af9 2 #include "SDFileSystem.h"
aismail1997 6:1aa86ad19af9 3
aismail1997 6:1aa86ad19af9 4 void moveServoIn(PwmOut servo, DigitalIn pb)
aismail1997 6:1aa86ad19af9 5 {
aismail1997 6:1aa86ad19af9 6 while(pb == 1)
aismail1997 6:1aa86ad19af9 7 //myled = 1;
aismail1997 6:1aa86ad19af9 8 // rotate 90 degrees one way
aismail1997 6:1aa86ad19af9 9 for(int i=3; i<=7; i++) {
aismail1997 6:1aa86ad19af9 10 servo = i/100.0;
aismail1997 6:1aa86ad19af9 11 wait(0.01);
aismail1997 6:1aa86ad19af9 12 }
aismail1997 6:1aa86ad19af9 13 }
aismail1997 6:1aa86ad19af9 14
aismail1997 6:1aa86ad19af9 15 void moveServoOut(PwmOut servo, DigitalIn pb)
aismail1997 6:1aa86ad19af9 16 {
aismail1997 6:1aa86ad19af9 17 while(pb == 1)
aismail1997 6:1aa86ad19af9 18 //myled = 0;
aismail1997 6:1aa86ad19af9 19 for(int i=7; i>3; i--) {
aismail1997 6:1aa86ad19af9 20 servo = i/100.0;
aismail1997 6:1aa86ad19af9 21 wait(0.01);
aismail1997 6:1aa86ad19af9 22 }
aismail1997 6:1aa86ad19af9 23 }
aismail1997 6:1aa86ad19af9 24
aismail1997 6:1aa86ad19af9 25 void playSound(wave_player waver)
aismail1997 6:1aa86ad19af9 26 {
aismail1997 6:1aa86ad19af9 27 FILE *wave_file;
aismail1997 6:1aa86ad19af9 28 wave_file=fopen("/sd/police_siren.wav","r");
aismail1997 6:1aa86ad19af9 29 waver.play(wave_file);
aismail1997 6:1aa86ad19af9 30 fclose(wave_file);
aismail1997 6:1aa86ad19af9 31 }