wave player pwm & covox
Dependencies: wave_player_pwm_and_covox mbed USBHost
main.cpp
- Committer:
- vsolonar
- Date:
- 2019-01-03
- Revision:
- 11:d2099045bdc9
- Parent:
- 10:c3614ed19126
File content as of revision 11:d2099045bdc9:
/* Big green ugly etc. Free for use bla bla bla. Do not eat. Tested on stm32f746zg Fast creepy transformation DAC_PWM WavePlayer SD_Card to usb_flash_stick PWM_Covox WavePlayer Based on Lucy Lenhardt wave_player_pwm_and_dac https://os.mbed.com/users/lenhardt/code/wave_player_pwm_and_dac/ */ #include "mbed.h" //#include "pinout.h" #include "USBHostMSD.h" #include "wave_player.h" Serial pc(USBTX, USBRX, 115200); // tx, rx, baud rate AnalogOut dac(PA_5); PwmOut enb(PA_6); wave_player player(&dac, &enb); int main() { USBHostMSD msd("usb"); while(1) { while(!msd.connect()) { pc.printf("Waiting for USB\r\n"); wait_ms(500); } pc.printf("Flash mounted\r\n"); FILE * fp = fopen("/usb/test1.wav", "rb"); if (fp != NULL) { pc.printf("File opened, reading...\r\n"); player.play(fp); fclose(fp); pc.printf("File closed\r\n"); } else { pc.printf("FILE == NULL\r\n"); } if (!msd.connected()) break; } }