initial

Dependencies:   ATParser mbed

Files at this revision

API Documentation at this revision

Comitter:
youngs2
Date:
Tue Apr 03 14:43:43 2018 +0000
Child:
1:1c928ac1083f
Commit message:
initial

Changed in this revision

ATParser.lib Show annotated file Show diff for this revision Revisions of this file
main.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/ATParser.lib	Tue Apr 03 14:43:43 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/teams/components/code/ATParser/#6b8190f55d83
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Apr 03 14:43:43 2018 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+#include "ATParser.h"
+//#define my_assert(b) if (!b) error("ASSERT FAILED at %s, line %d.\n", __FILE__, __LINE__);
+#include "assert.h"
+
+Serial pc(SERIAL_TX, SERIAL_RX, 115200);
+Serial device(PA_9, PA_10, 115200);  // tx, rx
+DigitalOut myled(LED1);
+
+ATParser at = ATParser(serial, "\r\n");
+
+int connect()
+{
+    char buffer[100]
+    assert(at.send("AT") && at.send("OK"));
+    assert(at.send("AT+N1=1,MTCDT-19400691") && at.recv("Set Network Name: MTCDT-19400691") && at.recv("OK"));
+    assert(at.send("AT+NK=1,MTCDT-19400691") && at.recv("Set Network Passphrase: MTCDT-19400691") && at.recv("OK"));
+    assert(at.send("AT+FSB=1") && at.recv("OK"));
+    assert(at.send("AT+JOIN") && at.recv("Successfully joined network") && at.recv("OK"));
+    assert(at.send("AT+DI") && at.recv("%s\r\nOK", buffer));
+    return(0);
+}
+
+int main() {    
+    while(1) {
+        if(pc.readable()) {
+            device.putc(pc.getc());
+            myled = !myled;
+        }
+        if(device.readable()) {
+            pc.putc(device.getc());
+            myled = !myled;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Apr 03 14:43:43 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/994bdf8177cb
\ No newline at end of file