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.
main.cpp
00001 #include "mbed.h" 00002 #include "Beeper.h" 00003 #include "TextLCD.h" 00004 00005 00006 Beeper myBeeper(p21); 00007 AnalogIn ain(p20); 00008 TextLCD lcd(p24, p25, p26, p27, p28, p29, p30); // rs, rw, e, d0, d1, d2, d3 00009 float f; 00010 float C4, D4, E4, F4, G4, A4, B4, C5; //keys 00011 float t=.2; //tempol 00012 int p=0; 00013 int size; 00014 00015 const float freq[8] = {261.63, 293.67, 329.63, 349.23, 392.00, 440.00,493.88, 523.25}; 00016 //const char freq[2] = {C4, D5}; 00017 00018 const int song[] = {5,3,3, 00019 4,2,2, 00020 1,2,3,4, 00021 5,5,5, 00022 5,3,3, 00023 4,2,2, 00024 1,3,5,5,1,1, 00025 2,2,2,2, 00026 2,3,4, 00027 3,3,3,3, 00028 3,4,5, 00029 5,3,3, 00030 4,2,2, 00031 1,3,5,5,1, 1 00032 }; 00033 00034 int main() { 00035 00036 size=sizeof(song)/sizeof(*song); // size of element in the array 00037 while (1) { 00038 for (int i = 0; i <size-1; i++) { 00039 p=song[i]; 00040 // wait(1); 00041 myBeeper.beep(freq[p-1], t); 00042 lcd.locate(0,0); 00043 lcd.printf("%d",sizeof(song)); 00044 lcd.locate(0,1); 00045 lcd.printf("%d",sizeof(*song)); 00046 00047 } 00048 } 00049 }
Generated on Thu Jul 14 2022 18:33:12 by
1.7.2