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.
Revision 0:f93e2f7b0139, committed 2014-02-26
- Comitter:
- KalebBro
- Date:
- Wed Feb 26 02:07:38 2014 +0000
- Commit message:
- I HAS CAKE!;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832.lib Wed Feb 26 02:07:38 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/chris/code/C12832/#7de323fa46fe
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Slave.cpp Wed Feb 26 02:07:38 2014 +0000
@@ -0,0 +1,176 @@
+#include "mbed.h"
+#include "music.h"
+#include "C12832.h"
+DigitalIn play(p14);
+
+I2CSlave slave(p9, p10);
+PwmOut speaker(p26);
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+C12832 lcd(p5, p7, p6, p8, p11);
+
+Serial term(USBTX, USBRX);
+
+float fu = 2;
+float ha = fu/2;
+float qu = fu/4;
+float tq = fu*3/4;
+float ei = fu/8;
+float si = fu / 16;
+
+//static char cake[] = {
+//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+//1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
+//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+//1 2 3 4 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//0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+static char cake[] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,
+0x00,0x00,0x7f,0xea,0xff,0xf0,0x00,0x00,
+0x00,0x03,0x00,0x0a,0x00,0x0c,0x00,0x00,
+0x00,0x0c,0x00,0x0a,0x00,0x03,0x00,0x00,
+0x00,0x08,0x00,0x0a,0x00,0x00,0x80,0x00,
+0x00,0x18,0x00,0x0a,0x00,0x01,0x80,0x00,
+0x00,0x14,0x00,0x0a,0x00,0x02,0x80,0x00,
+0x00,0x12,0x00,0x00,0x00,0x04,0x80,0x00,
+0x00,0x11,0x00,0x00,0x00,0x08,0x80,0x00,
+0x00,0x10,0xff,0xff,0xff,0xf0,0x80,0x00,
+0x00,0x10,0x00,0x00,0x00,0x00,0x80,0x00,
+0x00,0x18,0x00,0x00,0x00,0x01,0x80,0x00,
+0x00,0x14,0x00,0x00,0x00,0x02,0x80,0x00,
+0x00,0x12,0x00,0x00,0x00,0x04,0x80,0x00,
+0x00,0x11,0x00,0x00,0x00,0x08,0x80,0x00,
+0x00,0x10,0xff,0xff,0xff,0xf0,0x80,0x00,
+0x00,0x10,0x00,0x00,0x00,0x00,0x80,0x00,
+0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x00,
+0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,
+0x00,0x02,0x00,0x00,0x00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fs4,B4,Fs4,Gs4,B4,Fs4,Gs4,B4,B4,Cs5,Eb5,B4,Fs4,Gs4,Fs4,
+ B4,B4,Bb4,B4,Fs4,Gs4,B4,E5,Eb5,E5,Fs5,Eb5,Cs5,B4,Fs4,Gs4,B4,Fs4,Gs4,B4,Cs5,Eb5,Cs5,E5,Eb5,E5,Fs5,
+ B4,B4,Fs4,Gs4,B4,Fs4,E5,Eb5,Cs5,B4,E4,Eb4,E4,Fs4,B4,Fs4,Gs4,B4,Fs4,Gs4,B4,B4,Cs5,Eb5,B4,Fs4,Gs4,Fs4,
+ B4,B4,Bb4,B4,Fs4,Gs4,B4,E5,Eb5,E5,Fs5,B4,B4
+ };
+float nyanBeat[]= {si,si,ei,si,si,si,si,si,si,si,si,si,si,ei,ei,si,si,ei,si,si,si,si,si,si,si,si,ei,
+ ei,ei,si,ei,si,si,si,ei,ei,ei,ei,si,si,si,si,si,si,si,si,si,si,si,si,si,si,
+ ei,ei,si,si,si,si,si,si,si,si,si,si,si,si,ei,si,si,si,si,si,si,si,si,ei,ei,ei,ei,ei,si,ei,si,si,si,ei,ei,ei,
+ ei,si,si,si,si,si,si,si,si,si,si,si,si,si,si,ei,ei,si,si,si,si,si,si,si,si,si,si,si,si,
+ ei,si,si,si,si,si,si,si,si,ei,ei,ei,ei,si,si,ei,si,si,si,si,si,si,si,si,si,si,
+ ei,ei,si,si,si,si,si,si,si,si,si,si,si,si,ei,si,si,ei,si,si,si,si,si,si,si,si,si,si,
+ ei,si,si,si,si,si,si,si,si,si,si,ei,ei,ei,si,si,ei,si,si,si,si,si,si,si,si,si,si,
+ ei,ei,si,si,si,si,si,si,si,si,si,si,si,si,ei,si,si,ei,si,si,si,si,si,si,si,si,si,si,
+ ei,si,si,si,si,si,si,si,si,si,si,si,si
+ };//beat array
+
+int main() {
+ slave.address(0x42);
+ lcd.print_bm(bitmCake,0,0); // print cake
+ lcd.copy_to_lcd();
+ while(1) {
+ int foo = slave.receive();
+ term.printf("foo = %d\n\r", foo);
+ unsigned char noteNum = slave.read();
+ switch (foo) {
+ case I2CSlave::WriteAddressed:
+ if (noteNum == 0xFF) speaker = 0;
+ speaker.period(1 / (2 * notes[noteNum]));
+ term.printf("noteNum = %d\n\r", noteNum);
+ speaker = .5;
+ break;
+ case I2CSlave::ReadAddressed:
+ for (int i = 0; i < sizeof(nyanNotes)/sizeof(nyanNotes[0]); i++) {
+ slave.write(nyanNotes[i]);
+ speaker = 0.5;
+ unsigned char note = nyanNotes[i];
+ speaker.period(1/notes[note]);
+ wait(nyanBeat[i]/20.0f);
+ }
+ speaker = 0;
+ break;
+
+ }
+ }
+}
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Feb 26 02:07:38 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/music.h Wed Feb 26 02:07:38 2014 +0000
@@ -0,0 +1,72 @@
+enum NoteName {C0=0,Cs0,D0,Eb0,E0,F0,Fs0,G0,Gs0,A0,Bb0,B0,
+ C1,Cs1,D1,Eb1,E1,F1,Fs1,G1,Gs1,A1,Bb1,B1,
+ C2,Cs2,D2,Eb2,E2,F2,Fs2,G2,Gs2,A2,Bb2,B2,
+ C3,Cs3,D3,Eb3,E3,F3,Fs3,G3,Gs3,A3,Bb3,B3,
+ C4,Cs4,D4,Eb4,E4,F4,Fs4,G4,Gs4,A4,Bb4,B4,
+ C5,Cs5,D5,Eb5,E5,F5,Fs5,G5,Gs5,A5,Bb5,B5,
+ C6,Cs6,D6,Eb6,E6,F6,Fs6,G6,Gs6,A6,Bb6,B6,
+ C7,Cs7,D7,Eb7,E7,F7,Fs7,G7,Gs7,A7,Bb7,B7,
+ C8,Cs8,D8,Eb8,E8,F8,Fs8,G8,Gs8,A8,Bb8,B8,R};
+//frequencies for all of the notes
+float notes[]={16.35,17.32,18.35,19.45,20.60,21.83,23.12,24.50,25.96,27.50,29.14,30.87,
+ 32.70,34.65,36.71,38.89,41.20,43.65,46.25,49.00,51.91,55.00,58.27,61.74,
+ 65.41,69.30,73.42,77.78,82.41,87.31,92.50,98.00,103.8,110.0,116.5,123.5,
+ 130.8,138.6,146.8,155.6,164.8,174.6,185.0,196.0,207.7,220.0,233.1,246.9,
+ 261.6,277.2,293.7,311.1,329.6,349.2,370.0,392.0,415.3,440.0,466.2,493.9,
+ 523.3,554.4,587.3,622.3,659.3,698.5,740.0,784.0,830.6,880.0,932.3,987.8,
+ 1047,1109,1175,1245,1319,1397,1480,1568,1661,1760,1865,1976,
+ 2093,2217,2349,2489,2637,2794,2960,3136,3322,3520,3729,3951,
+ 4186,4435,4699,4978,5274,5588,5920,6272,6645,7040,7459,7902,0};
+
+
+
+char lyrics[][75] = {
+"This was a triumph.",
+"I'm making a note here: \r\n HUGE SUCCESS.",
+"It's hard to overstate my \r\n satisfaction.",
+"Aperture Science",
+"We do what we must",
+"because we can.",
+"For the good of all of us.",
+"Except the ones who are \r\n dead.",
+"But there's no sense \r\n crying over every mistake.",
+"You just keep on trying \r\n till you run out of cake.",
+"And the Science gets done.",
+"And you make a neat gun.",
+"For the people who are \r\n still alive.",
+" <3 ",
+"I'm not even angry.",
+"I'm being so sincere \r\n right now.",
+"\r\n Even though you broke \r\n my heart.",
+"And killed me.",
+"And tore me to pieces.",
+"And threw every piece \r\n into a fire.",
+"As they burned it hurt \r\n because I was so \r\n happy for you!",
+"Now these points of data \r\n make a beautiful line.",
+"And we're out of beta.",
+"We're releasing on time.",
+"So I'm GLaD. I got burned.",
+"Think of all the things we \r\n learned",
+"\r\nfor the people who are \r\n still alive.",
+" <3 ",
+"Go ahead and leave me.",
+"I think I prefer to \r\n stay inside.",
+"Maybe you'll find someone \r\n else to help you.",
+"Maybe Black Mesa",
+"THAT WAS A JOKE.",
+"HAHA. FAT CHANCE.",
+"Anyway, this cake is great.",
+"It's so delicious and moist.",
+"Look at me still talking",
+"when there's Science to do.",
+"When I look out there, \r\n it makes me GLaD I'm not you.",
+"I've experiments to run.",
+"There is research \r\n to be done.",
+"On the people who are \r\n still alive.",
+"And believe me I am \r\n still alive.",
+"I'm doing Science and I'm \r\n still alive.",
+"I feel FANTASTIC and I'm \r\n still alive.",
+"While you're dying I'll be \r\n still alive.",
+"And when you're dead I will be \r\n still alive.",
+"Still alive.",
+"Still alive."};
\ No newline at end of file