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.
Dependencies: 4DGL-uLCD-SE mbed
Revision 0:7679168f2d6e, committed 2016-03-27
- Comitter:
- taoqiuyang
- Date:
- Sun Mar 27 20:54:14 2016 +0000
- Commit message:
- lab5-4
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/4DGL-uLCD-SE.lib Sun Mar 27 20:54:14 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/4180_1/code/4DGL-uLCD-SE/#e39a44de229a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Mar 27 20:54:14 2016 +0000
@@ -0,0 +1,60 @@
+#include "mbed.h"
+#include "uLCD_4DGL.h"
+
+Serial pc(USBTX, USBRX);
+uLCD_4DGL lcd(p13, p14, p15);
+AnalogIn ain(p20);
+
+
+char PC_message[256];
+int PC_message_counter=0;
+int PC_message_length=0;
+
+
+void setup_lcd(){
+ lcd.baudrate(3000000);
+ lcd.background_color(0);
+ lcd.cls();
+ lcd.printf("Initializing...");
+}
+
+
+void update_lcd(){
+ lcd.cls();
+ lcd.locate(0,0);
+ for(int i=0;i<PC_message_length;i++){
+ lcd.printf("%c",PC_message[i]);
+ wait(0.01);
+ }
+}
+
+
+void PC_serial_ISR() {
+ char buf;
+
+ while (pc.readable()) {
+ buf = pc.getc();
+
+ PC_message[PC_message_counter]=buf;
+ PC_message_counter+=1;
+
+ if (buf=='\n'){
+ PC_message_length=PC_message_counter-1;
+ PC_message_counter=0;
+
+ update_lcd();
+ }
+ }
+}
+
+
+int main() {
+ pc.baud(9600);
+ pc.attach(&PC_serial_ISR);
+ setup_lcd();
+
+ while (1) {
+ pc.printf("%2.2f\n",ain.read()*1.0f);
+ wait(1);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Mar 27 20:54:14 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file