Wifi IoT Project

Dependencies:   4DGL-uLCD-SE mbed

Committer:
yscho529
Date:
Tue Nov 01 19:51:07 2016 +0000
Revision:
0:6e8326358c6c
Wifi IoT

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yscho529 0:6e8326358c6c 1 #include "mbed.h"
yscho529 0:6e8326358c6c 2 #include "uLCD_4DGL.h"
yscho529 0:6e8326358c6c 3 #include "Speaker.h"
yscho529 0:6e8326358c6c 4 #include "song.h"
yscho529 0:6e8326358c6c 5
yscho529 0:6e8326358c6c 6 uLCD_4DGL uLCD(p9,p10,p11);
yscho529 0:6e8326358c6c 7 Speaker mySpeaker(p26);
yscho529 0:6e8326358c6c 8
yscho529 0:6e8326358c6c 9 void playsong1(void) {
yscho529 0:6e8326358c6c 10 uLCD.cls();
yscho529 0:6e8326358c6c 11 uLCD.printf("Oh! If I had a daughter, sir, I'd dress her in White and Gold!");
yscho529 0:6e8326358c6c 12 mySpeaker.PlayNote(392, 0.5, 0.3); //1 G quarter
yscho529 0:6e8326358c6c 13 mySpeaker.PlayNote(349.23, 0.25, 0.3); //2 F eighth
yscho529 0:6e8326358c6c 14 mySpeaker.PlayNote(311.3, 0.5, 0.3); //3 E flat quarter
yscho529 0:6e8326358c6c 15 mySpeaker.PlayNote(311.3, 0.25, 0.3); //4 E flat eighth
yscho529 0:6e8326358c6c 16 mySpeaker.PlayNote(311.3, 0.5, 0.3); //5 E flat quarter
yscho529 0:6e8326358c6c 17 mySpeaker.PlayNote(349.23, 0.25, 0.3); //6 F eighth
yscho529 0:6e8326358c6c 18 mySpeaker.PlayNote(392, 0.5, 0.3); //7 G quarter
yscho529 0:6e8326358c6c 19 mySpeaker.PlayNote(392, 0.25, 0.3); //8 G eighth
yscho529 0:6e8326358c6c 20 mySpeaker.PlayNote(392, 0.25, 0.3); //9 G eighth
yscho529 0:6e8326358c6c 21 mySpeaker.PlayNote(349.23, 0.25, 0.3); //10 F eighth
yscho529 0:6e8326358c6c 22 mySpeaker.PlayNote(311.3, 0.25, 0.3); //11 E flat eighth
yscho529 0:6e8326358c6c 23 mySpeaker.PlayNote(349.23, 0.25, 0.3); //12 F eighth
yscho529 0:6e8326358c6c 24 mySpeaker.PlayNote(392, 0.25, 0.3); //13 G eighth
yscho529 0:6e8326358c6c 25 mySpeaker.PlayNote(349.23, 0.25, 0.3); //14 F eighth
yscho529 0:6e8326358c6c 26 mySpeaker.PlayNote(311.3, 0.5, 0.3); //15 E flat quarter
yscho529 0:6e8326358c6c 27 mySpeaker.PlayNote(293.66, 0.25, 0.3); //16 D eighth
yscho529 0:6e8326358c6c 28 mySpeaker.PlayNote(311.3, 0.6, 0.3); //17 E flat extended quarter
yscho529 0:6e8326358c6c 29 }
yscho529 0:6e8326358c6c 30
yscho529 0:6e8326358c6c 31 void playsong2(void) {
yscho529 0:6e8326358c6c 32 uLCD.cls();
yscho529 0:6e8326358c6c 33 uLCD.printf("Mary had a little lamb. Its fleece was white as snow!");
yscho529 0:6e8326358c6c 34 mySpeaker.PlayNote(493.88, 0.5, 0.3); //1 B quarter
yscho529 0:6e8326358c6c 35 mySpeaker.PlayNote(440, 0.5, 0.3); //2 A quarter
yscho529 0:6e8326358c6c 36 mySpeaker.PlayNote(392, 0.5, 0.3); //3 G quarter
yscho529 0:6e8326358c6c 37 mySpeaker.PlayNote(440, 0.5, 0.3); //4 A quarter
yscho529 0:6e8326358c6c 38 mySpeaker.PlayNote(493.88, 0.5, 0.3); //5 B quarter
yscho529 0:6e8326358c6c 39 mySpeaker.PlayNote(493.88, 0.5, 0.3); //6 B quarter
yscho529 0:6e8326358c6c 40 mySpeaker.PlayNote(493.88, 0.5, 0.3); //7 B quarter
yscho529 0:6e8326358c6c 41 mySpeaker.PlayNote(493.88, 0.5, 0.3); //8 B quarter
yscho529 0:6e8326358c6c 42 mySpeaker.PlayNote(440, 0.5, 0.3); //9 A quarter
yscho529 0:6e8326358c6c 43 mySpeaker.PlayNote(440, 0.5, 0.3); //10 A quarter
yscho529 0:6e8326358c6c 44 mySpeaker.PlayNote(493.88, 0.5, 0.3); //11 B quarter
yscho529 0:6e8326358c6c 45 mySpeaker.PlayNote(440, 0.5, 0.3); //12 A quarter
yscho529 0:6e8326358c6c 46 mySpeaker.PlayNote(392, 2, 0.3); //13 G whole
yscho529 0:6e8326358c6c 47 }
yscho529 0:6e8326358c6c 48
yscho529 0:6e8326358c6c 49 void playsong3(void) {
yscho529 0:6e8326358c6c 50 uLCD.cls();
yscho529 0:6e8326358c6c 51 uLCD.printf("B-I-N-G-O! And Bingo was his name-o!");
yscho529 0:6e8326358c6c 52 mySpeaker.PlayNote(261.63, 2, 0.3); //1 C whole
yscho529 0:6e8326358c6c 53 mySpeaker.PlayNote(261.63, 2, 0.3); //2 C whole
yscho529 0:6e8326358c6c 54 mySpeaker.PlayNote(293.66, 0.5, 0.3); //3 D quarter
yscho529 0:6e8326358c6c 55 mySpeaker.PlayNote(293.66, 0.5, 0.3); //4 D quarter
yscho529 0:6e8326358c6c 56 mySpeaker.PlayNote(293.66, 0.5, 0.3); //5 D quarter
yscho529 0:6e8326358c6c 57 mySpeaker.PlayNote(261.63, 0.5, 0.3); //6 C quarter
yscho529 0:6e8326358c6c 58 mySpeaker.PlayNote(264.94, 0.5, 0.3); //7 B quarter
yscho529 0:6e8326358c6c 59 mySpeaker.PlayNote(196, 0.5, 0.3); //8 G quarter
yscho529 0:6e8326358c6c 60 mySpeaker.PlayNote(220, 0.5, 0.3); //9 A quarter
yscho529 0:6e8326358c6c 61 mySpeaker.PlayNote(249.94, 0.5, 0.3); //10 B quarter
yscho529 0:6e8326358c6c 62 mySpeaker.PlayNote(261.03, 0.5, 0.3); //11 C whole
yscho529 0:6e8326358c6c 63 mySpeaker.PlayNote(261.03, 0.5, 0.3); //12 C whole
yscho529 0:6e8326358c6c 64 }
yscho529 0:6e8326358c6c 65
yscho529 0:6e8326358c6c 66 void playsong4(void) {
yscho529 0:6e8326358c6c 67 uLCD.cls();
yscho529 0:6e8326358c6c 68 uLCD.printf("Are you sleeping? Are you sleeping? Brother John? Brother John?");
yscho529 0:6e8326358c6c 69 mySpeaker.PlayNote(261.63, 0.5, 0.3); //1 C quarter
yscho529 0:6e8326358c6c 70 mySpeaker.PlayNote(293.66, 0.5, 0.3); //2 D quarter
yscho529 0:6e8326358c6c 71 mySpeaker.PlayNote(329.63, 0.5, 0.3); //3 E quarter
yscho529 0:6e8326358c6c 72 mySpeaker.PlayNote(261.63, 0.5, 0.3); //4 C quarter
yscho529 0:6e8326358c6c 73 mySpeaker.PlayNote(261.63, 0.5, 0.3); //5 C quarter
yscho529 0:6e8326358c6c 74 mySpeaker.PlayNote(293.66, 0.5, 0.3); //6 D quarter
yscho529 0:6e8326358c6c 75 mySpeaker.PlayNote(329.63, 0.5, 0.3); //7 E quarter
yscho529 0:6e8326358c6c 76 mySpeaker.PlayNote(261.63, 0.5, 0.3); //8 C quarter
yscho529 0:6e8326358c6c 77 mySpeaker.PlayNote(329.63, 0.5, 0.3); //9 E quarter
yscho529 0:6e8326358c6c 78 mySpeaker.PlayNote(349.23, 0.5, 0.3); //10 F quarter
yscho529 0:6e8326358c6c 79 mySpeaker.PlayNote(392, 1, 0.3); //11 G half
yscho529 0:6e8326358c6c 80 mySpeaker.PlayNote(329.63, 0.5, 0.3); //12 E quarter
yscho529 0:6e8326358c6c 81 mySpeaker.PlayNote(349.23, 0.5, 0.3); //13 F quarter
yscho529 0:6e8326358c6c 82 mySpeaker.PlayNote(392, 1, 0.3); //14 G half
yscho529 0:6e8326358c6c 83 }