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 WebSocketClient mbed
main.cpp
- Committer:
- wgd8700
- Date:
- 2015-10-07
- Revision:
- 0:47ec083185d0
- Child:
- 1:610f3dc5679e
File content as of revision 0:47ec083185d0:
#include "mbed.h"
#include "EthernetInterface.h"
#include "Websocket.h"
#include "WIFIDevice.h"
WIFIDevice wifi;
Serial pc(USBTX, USBRX);
int main() {
char recv[30];
pc.baud(115200);
pc.printf("Init...\n");
EthernetInterface eth;
eth.init(); //Use DHCP
// set given SSID and PW as the highest priority
wifi.setNetwork("Tsungta_iPhone", "icq87001", 0);
eth.connect(40000);
pc.printf("IP Address:%s\n",eth.getIPAddress());
pc.printf("MAC Address:%s\n",eth.getMACAddress());
Websocket ws("ws://172.20.10.11:8888/ws");
ws.connect();
while (1) {
ws.send("WebSocket Hello World over Ethernet");
wait(1.0);
}
}