Matthew Newton
/
Display
WIP
main.cpp@0:2df1d679a1bd, 2013-04-06 (annotated)
- Committer:
- mnewton1
- Date:
- Sat Apr 06 17:18:41 2013 +0000
- Revision:
- 0:2df1d679a1bd
Work in progress.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mnewton1 | 0:2df1d679a1bd | 1 | #include "mbed.h" |
mnewton1 | 0:2df1d679a1bd | 2 | |
mnewton1 | 0:2df1d679a1bd | 3 | unsigned char splash[] = //splash screen string |
mnewton1 | 0:2df1d679a1bd | 4 | { |
mnewton1 | 0:2df1d679a1bd | 5 | 254, 57, 51, //change baud rate to 19200 |
mnewton1 | 0:2df1d679a1bd | 6 | 254, 88, //clear screen |
mnewton1 | 0:2df1d679a1bd | 7 | 254, 82, //auto scroll off |
mnewton1 | 0:2df1d679a1bd | 8 | 254, 71, 4, 2, //set cursor column 4, row 2 |
mnewton1 | 0:2df1d679a1bd | 9 | 70, 111, 114, 109, 117, 108, 97, 32, 72, 121, 98, 114, 105, 100, //print "Formula Hybrid" |
mnewton1 | 0:2df1d679a1bd | 10 | }; |
mnewton1 | 0:2df1d679a1bd | 11 | |
mnewton1 | 0:2df1d679a1bd | 12 | unsigned char data[] = //data screen initialization string |
mnewton1 | 0:2df1d679a1bd | 13 | { |
mnewton1 | 0:2df1d679a1bd | 14 | 254, 88, //clear screen |
mnewton1 | 0:2df1d679a1bd | 15 | 254, 72, //set cursor home |
mnewton1 | 0:2df1d679a1bd | 16 | 83, 112, 101, 101, 100, 32, 32, 32, 32, 32, 32, 58, //print "Speed: " |
mnewton1 | 0:2df1d679a1bd | 17 | 254, 71, 1, 2, //set curser to column 1, row 2 |
mnewton1 | 0:2df1d679a1bd | 18 | 73, 67, 69, 32, 84, 101, 109, 112, 32, 32, 32, 58, 32, 32, 32, 32, 32, 32,//print "ICE Temp: " |
mnewton1 | 0:2df1d679a1bd | 19 | 254, 71, 1, 3, //set curser to column 1, row 3 |
mnewton1 | 0:2df1d679a1bd | 20 | 72, 86, 32, 66, 97, 116, 116, 101, 114, 121, 32, 58, 32, 32, 32, 32, //print "HV Battery: " |
mnewton1 | 0:2df1d679a1bd | 21 | 254, 71, 1, 4, //set curser to column 1, row 4 |
mnewton1 | 0:2df1d679a1bd | 22 | 70, 117, 101, 108, 32, 76, 101, 118, 101, 108, 32, 58 //print "Fuel Level: " |
mnewton1 | 0:2df1d679a1bd | 23 | }; |
mnewton1 | 0:2df1d679a1bd | 24 | |
mnewton1 | 0:2df1d679a1bd | 25 | |
mnewton1 | 0:2df1d679a1bd | 26 | int main() |
mnewton1 | 0:2df1d679a1bd | 27 | { |
mnewton1 | 0:2df1d679a1bd | 28 | Serial lcd(p9, p10); // tx, rx |
mnewton1 | 0:2df1d679a1bd | 29 | lcd.baud(19200); |
mnewton1 | 0:2df1d679a1bd | 30 | |
mnewton1 | 0:2df1d679a1bd | 31 | void loop(); |
mnewton1 | 0:2df1d679a1bd | 32 | { |
mnewton1 | 0:2df1d679a1bd | 33 | for(int i = 0; i <= sizeof(splash); ++i) |
mnewton1 | 0:2df1d679a1bd | 34 | { |
mnewton1 | 0:2df1d679a1bd | 35 | lcd.putc(splash[i]); |
mnewton1 | 0:2df1d679a1bd | 36 | wait(0.05); |
mnewton1 | 0:2df1d679a1bd | 37 | } |
mnewton1 | 0:2df1d679a1bd | 38 | |
mnewton1 | 0:2df1d679a1bd | 39 | wait(5); |
mnewton1 | 0:2df1d679a1bd | 40 | |
mnewton1 | 0:2df1d679a1bd | 41 | for(int j = 0; j <= sizeof(data); ++j) |
mnewton1 | 0:2df1d679a1bd | 42 | { |
mnewton1 | 0:2df1d679a1bd | 43 | lcd.putc(data[j]); |
mnewton1 | 0:2df1d679a1bd | 44 | wait(0.0001); |
mnewton1 | 0:2df1d679a1bd | 45 | } |
mnewton1 | 0:2df1d679a1bd | 46 | |
mnewton1 | 0:2df1d679a1bd | 47 | } |
mnewton1 | 0:2df1d679a1bd | 48 | } |