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.
Revision 0:c9d0008613d6, committed 2020-02-01
- Comitter:
- kchhouk
- Date:
- Sat Feb 01 17:53:46 2020 +0000
- Commit message:
- GSM Automation using SIM800L
Changed in this revision
| GSMProgramAutomation.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GSMProgramAutomation.cpp Sat Feb 01 17:53:46 2020 +0000
@@ -0,0 +1,65 @@
+#include "mbed.h"
+
+#define CTRL_Z 26 //Attach at the end of this message string
+
+Serial pc(USBTX, USBRX);
+Serial SIM800L(P3_1, P3_0);
+DigitalOut led1(LED1);
+
+char phone[14] = "\"17039739276\"";
+char buf[40];
+char buf1[40];
+
+long GSMBAUD = 9600;
+long PCBAUD = 9600;
+
+int main(){
+ pc.baud(PCBAUD);
+ SIM800L.baud(GSMBAUD);
+
+ //wait(0.1f);
+ SIM800L.puts("AT\r\n");
+ SIM800L.scanf("%s", buf);
+ SIM800L.scanf("%s", buf1);
+ pc.printf("%s\n", buf);
+ pc.printf("%s\n", buf1);
+
+ //wait(0.01f);
+
+ SIM800L.puts("AT+CMGF=1\r\n");
+ SIM800L.scanf("%s", buf);
+ SIM800L.scanf("%s", buf1);
+ pc.printf("%s\n", buf);
+ pc.printf("%s\n", buf1);
+
+ //wait(0.01f);
+ SIM800L.puts("AT+CMGS=\"17039739276\"\r\n");
+ //SIM800L.puts("\r\n");
+
+// SIM800L.scanf("%s", buf);
+// SIM800L.scanf("%s", buf1);
+// pc.printf("%s\n", buf);
+// pc.printf("%s\n", buf1);
+
+ wait(0.1f);
+
+ SIM800L.printf("This is the automatted program SMS from SIM800L. :D %c\r\n", CTRL_Z);
+ //wait(4);
+ //SIM800L.puts("26\r\n");
+
+ //wait(0.1f);
+ SIM800L.scanf("%s", buf);
+ SIM800L.scanf("%s", buf1);
+ pc.printf("%s\n", buf);
+ pc.printf("%s\n", buf1);
+
+ wait(1);
+
+ //pc.printf("Yike");
+ SIM800L.puts("AT+CMGF=0\r\n");
+ SIM800L.scanf("%s", buf);
+ SIM800L.scanf("%s", buf1);
+ pc.printf("%s\n", buf);
+ pc.printf("%s\n", buf1);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Feb 01 17:53:46 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file
