4180 lab 5

Dependencies:   mbed 4DGL-uLCD-SE RPCInterface

Revision:
7:c912354e8870
Parent:
6:96dd38c5d122
--- a/main.cpp	Sun Apr 05 19:49:49 2020 +0000
+++ b/main.cpp	Tue Apr 07 21:00:22 2020 +0000
@@ -1,19 +1,25 @@
 #include "mbed.h"
+//#include "mbed_rpc.h"
+#include "SerialRPCInterface.h"
 #include "uLCD_4DGL.h"
 
-Serial pc(USBTX, USBRX);
+SerialRPCInterface pc(USBTX, USBRX);
 
 uLCD_4DGL lcd(p28,p27,p30);
 
+void printToLcd(Arguments *in, Reply *out);
+
+RPCFunction rpcPrintToLcd(&printToLcd, "printToLcd");
+
 int main() {
-    pc.baud(9600);
-    
     lcd.cls();
 
     while (1) {
-        if (pc.readable()) {
-            lcd.printf("%c", pc.getc());
-        }
         wait(0.1);
     }
+}
+
+void printToLcd(Arguments *in, Reply *out) {
+    const char* str = in->getArg<const char*>();
+    lcd.printf("%c", str);
 }
\ No newline at end of file