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.
Dependencies: WIFI_API_32kRAM mbed
Fork of NNN40_WiFi by
Diff: main.cpp
- Revision:
- 0:25ffe5869e35
- Child:
- 1:f8f52bde7864
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Feb 05 07:55:58 2015 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+#include "WIFIDevice.h"
+
+
+WIFIDevice wifi;
+
+uint8_t ap_ssid[20] = {'H','T','C','S','V','\0'};
+uint8_t ap_pw[11] = {'1','1','1','1','1','1','1','1','\0'};
+
+const char* PC_SERVER_ADDRESS = "192.168.1.234";
+uint16_t PC_PORT = 5222;
+DigitalOut SW(SWIO);
+
+int main(void)
+{
+ EthernetInterface eth;
+ eth.init(); //Use DHCP
+ SW = 1;
+ wifi.setNetwork(ap_ssid, ap_pw, 0); // set given SSID and PW as the highest priority
+
+ eth.connect(40000);
+ DPRINT(N_ERR, "IP Address: %s\n",eth.getIPAddress());
+ DPRINT(N_ERR, "MAC Address: %s\n",eth.getMACAddress());
+
+
+ TCPSocketConnection socket;
+ DPRINT(N_ERR, "is_connected: %i\n",socket.is_connected());
+ socket.connect(PC_SERVER_ADDRESS,PC_PORT);
+ DPRINT(N_ERR, "is_connected: %i\n",socket.is_connected());
+ char msg[] = "Hello World";
+ socket.send(msg, sizeof(msg));
+
+ socket.close();
+ eth.disconnect();
+ wifi.sleep();
+}
+
