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:
- 6:76b89d8b62a0
- Parent:
- 5:76dd6da3e640
- Child:
- 7:ca5ed7936472
diff -r 76dd6da3e640 -r 76b89d8b62a0 text.cpp --- a/text.cpp Wed Jul 30 10:28:47 2014 +0000 +++ b/text.cpp Thu Oct 30 23:12:18 2014 +0000 @@ -6,6 +6,7 @@ void text::generate(string input){ stringLength = input.length(); + if (stringLength == 0) return; pc.printf("\r\nStarting generation, string length: %i", stringLength); fp = fopen("/local/out.txt", "w"); pc.printf("\r\nOpened a text file out.txt"); @@ -360,6 +361,34 @@ }; memcpy(temp, w, sizeof(w)); break; + case 'Y': + letSize = 5; + int y[8][8] = { + {1, 0, 0, 0, 1, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 0}, + {0, 1, 0, 1, 0, 0, 0, 0}, + {0, 0, 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, 0, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0}, + }; + memcpy(temp, y, sizeof(y)); + break; + case 'X': + letSize = 5; + int x[8][8] = { + {1, 0, 0, 0, 1, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 0}, + {0, 1, 0, 1, 0, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0}, + {0, 1, 0, 1, 0, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 0}, + {1, 0, 0, 0, 1, 0, 0, 0}, + }; + memcpy(temp, x, sizeof(x)); + break; case ' ': letSize = 3; int gap[8][8] = {