Matthew Newton
/
Display
WIP
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 00003 unsigned char splash[] = //splash screen string 00004 { 00005 254, 57, 51, //change baud rate to 19200 00006 254, 88, //clear screen 00007 254, 82, //auto scroll off 00008 254, 71, 4, 2, //set cursor column 4, row 2 00009 70, 111, 114, 109, 117, 108, 97, 32, 72, 121, 98, 114, 105, 100, //print "Formula Hybrid" 00010 }; 00011 00012 unsigned char data[] = //data screen initialization string 00013 { 00014 254, 88, //clear screen 00015 254, 72, //set cursor home 00016 83, 112, 101, 101, 100, 32, 32, 32, 32, 32, 32, 58, //print "Speed: " 00017 254, 71, 1, 2, //set curser to column 1, row 2 00018 73, 67, 69, 32, 84, 101, 109, 112, 32, 32, 32, 58, 32, 32, 32, 32, 32, 32,//print "ICE Temp: " 00019 254, 71, 1, 3, //set curser to column 1, row 3 00020 72, 86, 32, 66, 97, 116, 116, 101, 114, 121, 32, 58, 32, 32, 32, 32, //print "HV Battery: " 00021 254, 71, 1, 4, //set curser to column 1, row 4 00022 70, 117, 101, 108, 32, 76, 101, 118, 101, 108, 32, 58 //print "Fuel Level: " 00023 }; 00024 00025 00026 int main() 00027 { 00028 Serial lcd(p9, p10); // tx, rx 00029 lcd.baud(19200); 00030 00031 void loop(); 00032 { 00033 for(int i = 0; i <= sizeof(splash); ++i) 00034 { 00035 lcd.putc(splash[i]); 00036 wait(0.05); 00037 } 00038 00039 wait(5); 00040 00041 for(int j = 0; j <= sizeof(data); ++j) 00042 { 00043 lcd.putc(data[j]); 00044 wait(0.0001); 00045 } 00046 00047 } 00048 }
Generated on Sun Jul 31 2022 20:10:52 by 1.7.2