mbed based wave player

Dependencies:   wave_player mbed

Fork of SDFileSystem_HelloWorld by mbed official

main.cpp

Committer:
berzin11295
Date:
2018-07-19
Revision:
2:ea62438661bf
Parent:
0:bdbd3d6fc5d5

File content as of revision 2:ea62438661bf:

#include "mbed.h"
#include "SDFileSystem.h"
#include "WavPlayer.h"
 
SDFileSystem sd(PC_12,PC_11,PC_10,PD_2,"sd"); // the pinout on the mbed Cool Components workshop board

AnalogOut dac(PA_5);
DigitalOut enb(PA_12);
WavPlayer player(&dac, &enb);

int main() {
    printf("Hello World!\n");   
    
    FILE *fp = fopen("/sd/voices/hello_0.wav", "r");
    if(fp == NULL) {
        error("Could not open file for read\n");
    }
    
    player.play(fp);
    
    fclose(fp);
    printf("Bye World!\n");   
}