HoYa's MBED (Nucleo-F401RE)
Dependencies: NetworkSocketAPI X_NUCLEO_IDW01M1v2 mbed
Diff: main.cpp
- Revision:
- 0:63d30ec829b6
- Child:
- 1:b2b7580e09d7
--- /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