NNN40 run a HTTP server with RPC using Soft AP mode
Dependencies: WIFI_API_32kRAM mbed
Fork of HTTP-Server by
The sample code will run as a WiFi Soft AP mode with given AP configuration setting including SSID name and password. IP address (fixed to 192.168.2.1 for the current version of WIFI_API)of AP router will be print out once Soft AP mode is operating.
User can open their web browser and go to http://192.168.2.1/. and have a try on switch on a led. Firstly, we need to create an object to control a led
Then, led can be switch on using RPC command
More information cab be found from the links below
https://developer.mbed.org/users/feb11/code/HTTP-Server/
https://developer.mbed.org/cookbook/Interfacing-Using-RPC
Revision 11:f57e9de44f6f, committed 2015-09-16
- Comitter:
- wgd8700
- Date:
- Wed Sep 16 02:43:42 2015 +0000
- Parent:
- 10:8b4c3d605bf0
- Commit message:
- First commit;
Changed in this revision
--- a/EthernetInterface.lib Thu Jul 18 10:10:14 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/feb11/code/EthernetInterface/#f533841d34cb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WIFI_API_32kRAM.lib Wed Sep 16 02:43:42 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/Delta/code/WIFI_API_32kRAM/#ef82d9cc61cf
--- a/main.cpp Thu Jul 18 10:10:14 2013 +0000 +++ b/main.cpp Wed Sep 16 02:43:42 2015 +0000 @@ -7,8 +7,12 @@ #include "RequestHandler.h" #include "RPCType.h" +#include "WIFIDevice.h" + #define SERVER_PORT 80 +WIFIDevice wifi; + HTTPServer create_simple_server() { HTTPServer srv; @@ -30,12 +34,15 @@ RPCType::instance().register_types(); EthernetInterface eth; + //wifi.setNetwork("GainSpan_JS", "Delta9999", 0); + //wifi.setNetwork("TP-LINK_2.4G_TTWU", "0972753720", 0); + wifi.setAccessPoint("NNN40_TTWU", "0123456789", SECURITY_WPA2_TKIP_PSK, 2); if(eth.init()) { printf("Error while initializing the ethernet interface.\n"); return -1; } - if(eth.connect()) + if(eth.connect(60000)) { printf("Error while starting the ethernet interface.\n"); return -1;
--- a/mbed-rpc.lib Thu Jul 18 10:10:14 2013 +0000 +++ b/mbed-rpc.lib Wed Sep 16 02:43:42 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rpc/#1ecadde1c929 +https://developer.mbed.org/teams/Delta/code/mbed-rpc/#0e2b2ea12288
--- a/mbed-rtos.lib Thu Jul 18 10:10:14 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#58b30ac3f00e
--- a/mbed.bld Thu Jul 18 10:10:14 2013 +0000 +++ b/mbed.bld Wed Sep 16 02:43:42 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad \ No newline at end of file