Skip to content

Instantly share code, notes, and snippets.

@misodengaku
Last active December 15, 2015 08:39
Show Gist options
  • Save misodengaku/5232694 to your computer and use it in GitHub Desktop.
Save misodengaku/5232694 to your computer and use it in GitHub Desktop.
mbedのルートディレクトリに8bit unsigned RAWに変換した音声データを格納して実行 動画:http://www.youtube.com/watch?v=C1YDasSZ6lQ
#include "mbed.h"
LocalFileSystem local("local");
AnalogOut speaker(p18);
//Serial pc(USBTX, USBRX);
int main() {
FILE *fp;
int c;
fp = fopen("/local/hatoya.raw", "r");
while((c = fgetc(fp)) != EOF)
{
//speaker = c / 256.0;だとダメ
speaker.write(c / 256.0);
//pc.printf("%f\r\n", c / 256.0);
wait_us(125);
}
fclose(fp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment