HoYa's MBED (Nucleo-F401RE)
Dependencies: NetworkSocketAPI X_NUCLEO_IDW01M1v2 mbed
Revision 0:63d30ec829b6, committed 2017-07-20
- Comitter:
- HoYa
- Date:
- Thu Jul 20 06:44:02 2017 +0000
- Child:
- 1:b2b7580e09d7
- Commit message:
- Connect to AP
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NetworkSocketAPI.lib Thu Jul 20 06:44:02 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/teams/NetworkSocketAPI/code/NetworkSocketAPI/#ea3a618e0818
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/X_NUCLEO_IDW01M1v2.lib Thu Jul 20 06:44:02 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/ST/code/X_NUCLEO_IDW01M1v2/#c8697141ce44
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Jul 20 06:44:02 2017 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+#include "SpwfInterface.h"
+
+Serial pc(USBTX, USBRX, 115200);
+DigitalOut led(LED1);
+
+SpwfSAInterface spwf(D8, D2, true);
+
+int main() {
+ pc.printf("\r\n");
+ pc.printf("Start Application\r\n");
+
+ pc.printf("Connecting to AP...\r\n");
+ if (spwf.connect("hRPi3-AP", "rlawjdgh", NSAPI_SECURITY_WPA2)) {
+ pc.printf("=> Success.\r\n");
+ } else {
+ pc.printf("=> Failed to connect.\r\n");
+ return -1;
+ }
+
+ const char* ip = spwf.get_ip_address();
+ pc.printf("=> IP Address is: %s\r\n", (ip) ? ip : "No IP");
+ const char* mac = spwf.get_mac_address();
+ pc.printf("=> MAC Address is: %s\r\n", (mac) ? mac : "No MAC");
+
+ while (1) {
+ led = !led;
+ wait(0.5);
+ }
+}
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jul 20 06:44:02 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/a97add6d7e64 \ No newline at end of file