Blue LED matrix (8x16) program. Gets text string through bluetooth and displays it on led matrix. Also has a clock function- get system time from a phone through bluetooth and enters clock mode. In clock mode it acts as a clock showing hours and minutes and blinking led every second. Clock mode can be broken if a text string is received through bluetooth.
Dependencies: mbed
Diff: text.cpp
- Revision:
- 3:35a47548d29d
- Parent:
- 2:3cc1e2dec7a2
- Child:
- 5:76dd6da3e640
--- a/text.cpp Wed Jun 25 16:24:03 2014 +0000 +++ b/text.cpp Wed Jun 25 19:29:39 2014 +0000 @@ -1,19 +1,19 @@ #include "text.h" #include "mbed.h" -Serial pc(USBTX, USBRX); - -text::text(){ +text::text(): pc(USBTX, USBRX), local("local"){ }; void text::generate(string input){ - LocalFileSystem local("local"); stringLength = input.length(); pc.printf("\r\nStarting generation, string length: %i", stringLength); - FILE *fp = fopen("/local/out.txt", "w"); + fp = fopen("/local/out.txt", "w"); pc.printf("\r\nOpened a text file out.txt"); calcLength(input); fprintf(fp, "%i\r\n", length); + for (int i = 0; i < 16; i++){ + fprintf(fp, "00000000\r\n"); + } for (int i = 0; i < stringLength; i++){ pc.printf("\r\nTaking letter "); pc.putc(input.at(i)); @@ -192,7 +192,7 @@ memcpy(temp, k, sizeof(k)); break; case 'L': - letSize = 3; + letSize = 4; int l[8][8] = { {1, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}, @@ -201,7 +201,7 @@ {1, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 1, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 0, 0, 0, 0}, }; memcpy(temp, l, sizeof(l)); break; @@ -404,5 +404,5 @@ letters(input.at(i)); length += letSize + 1; } - length += 15; + length += 31; } \ No newline at end of file