bad

Dependencies:   mbed USBDevice

Revision:
0:5c1655777e38
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GSMTest2PICO.cpp	Fri Feb 21 20:35:47 2020 +0000
@@ -0,0 +1,64 @@
+#include "mbed.h"
+#include "USBSerial.h"
+//#include "string.h"
+
+// Blinking rate in milliseconds
+#define BLINKING_RATE_MS                                                    500
+#define CTRL_Z              26      //Attach at the end of this message string
+
+// Virtual serial port over USB
+USBSerial microUSB;
+Serial SIM800L(P0_1, P0_0); //tx, rx
+// Serial pc(USBTX, USBRX);
+char buf[40];
+char buf1[40];
+long GSMBAUD = 9600;
+// long PCBAUD  = 9600;
+
+int main()
+{
+    // Initialise the digital pin LED1 as an output
+    //DigitalOut led(LED1);
+
+    SIM800L.baud(GSMBAUD);
+    //microUSB.scanf("%s", buf);    
+    SIM800L.puts("AT\r\n");
+    SIM800L.scanf("%s", buf);
+    SIM800L.scanf("%s", buf1);
+    microUSB.printf("%s" , buf);
+    microUSB.printf("%s\n", buf1);
+    
+    SIM800L.puts("AT+CMGF=1\r\n");
+    SIM800L.scanf("%s", buf);
+    SIM800L.scanf("%s", buf1);
+    microUSB.printf("%s" , buf);
+    microUSB.printf("%s\n", buf1);
+    
+    SIM800L.puts("AT+CMGS=\"17039739276\"\r\n");
+    
+    wait(0.1f);
+
+    SIM800L.printf("This is the automatted program SMS from SIM800L. :D %c\r\n", CTRL_Z);
+    
+    SIM800L.scanf("%s", buf);
+    SIM800L.scanf("%s", buf1);
+    microUSB.printf("%s" , buf);
+    microUSB.printf("%s\n", buf1);
+    
+    wait(1);
+
+    //pc.printf("Yike");
+    SIM800L.puts("AT+CMGF=0\r\n");
+    SIM800L.scanf("%s", buf);
+    SIM800L.scanf("%s", buf1);
+    microUSB.printf("%s" , buf);
+    microUSB.printf("%s\n", buf1);
+        //led = !led;
+//        pc.printf("regular serial communication works!");
+        //microUSB.printf("you typed: %s\r\n",buf);
+        //microUSB.printf("\x1B[2J");  //clear terminal program screen
+//        while (SIM800L.readable()){
+//               microUSB.printf("%c", microUSB.putc((SIM800L.getc())));
+//        
+}
+