Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: TextLCD mbed SDFileSystem
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 #include "SDFileSystem.h" 00004 #include "MySound.h" 00005 00006 TextLCD lcd(p24, p26, p27, p28, p29, p30); 00007 SDFileSystem sd(p5, p6, p7, p8, "sd") ; 00008 MySound music(p21) ; 00009 00010 00011 int main() { 00012 char pitch ; 00013 int scale; 00014 char ln; 00015 FILE *fp; 00016 int n; 00017 00018 if ( (fp = fopen("/sd/music.txt","r")) == NULL ) { 00019 printf("Open Failed. \n") ; 00020 return -1; 00021 } 00022 lcd.printf("Silent Night"); 00023 00024 while( (n = fscanf(fp,"%c %d %c ",&pitch,&scale,&ln)) != EOF ){ 00025 printf("%d %c %d %c\n",n,pitch,scale,ln); 00026 music.play(pitch, scale, ln) ; 00027 } 00028 00029 fclose(fp) ; 00030 }
Generated on Sun Jul 17 2022 01:00:59 by
1.7.2