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.
main.cpp
00001 #include "mbed.h" 00002 00003 Serial pc(USBTX, USBRX); 00004 Serial lcd(p13, p14); 00005 00006 bool esc; 00007 void setSpark() { 00008 lcd.printf("%c%c",0xFE,0x01); 00009 lcd.printf("%c%c",0xFE,0x80); 00010 lcd.printf(" Sparkfun.com "); 00011 lcd.printf("%c%c",0xFE,0xC0); 00012 lcd.printf(" SerLCD v2 "); 00013 } 00014 void interrupt() { 00015 char in = pc.getc(); 00016 if (esc) { 00017 switch (in) { 00018 case 'h': 00019 pc.printf("esc+h - help text\r\n"); 00020 pc.printf("esc+s - sparkfun boot splash\r\n"); 00021 pc.printf("esc+c - clear screen\r\n"); 00022 pc.printf("esc+a - cursor on\r\n"); 00023 pc.printf("esc+z - cursor off\r\n"); 00024 pc.printf("esc+b - set boot splash\r\n"); 00025 pc.printf("esc+d - disable/enable boot splash\r\n"); 00026 break; 00027 case 'a': 00028 lcd.printf("%c%c",0xFE,0x0D); 00029 break; 00030 case 'z': 00031 lcd.printf("%c%c",0xFE,0x0C); 00032 break; 00033 case 'c': 00034 lcd.printf("%c%c%c%c",0xFE,0x01,0xFE,0x80); 00035 break; 00036 case 'd': 00037 lcd.printf("%c%c",0x7C,0x09); 00038 break; 00039 case 'b': 00040 lcd.printf("%c%c",0x7C,0x0A); 00041 break; 00042 case 's': 00043 setSpark(); 00044 break; 00045 } 00046 esc=0; 00047 } else { 00048 switch (in) { 00049 case 0x1b: 00050 esc=1; 00051 break; 00052 case 0x7C: 00053 case 0x0d: 00054 break; 00055 default : 00056 esc=0; 00057 lcd.printf("%c",in); 00058 pc.printf("%c",in,in); 00059 } 00060 } 00061 } 00062 int main() { 00063 pc.attach(&interrupt); 00064 while (1) { 00065 wait(.3); 00066 } 00067 } 00068
Generated on Sat Jul 16 2022 05:12:57 by
1.7.2