Delta / Mbed 2 deprecated NNN40_WiFi_SoftAP

Dependencies:   WIFI_API_32kRAM mbed

Fork of NNN40_WiFi by Delta

main.cpp

Committer:
wgd8700
Date:
2015-08-29
Revision:
13:6570897e31f8
Parent:
7:c497e792660d
Child:
14:1f8b31c4dcc1

File content as of revision 13:6570897e31f8:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "mbed.h"
#include "WIFIDevice.h"
#include "EthernetInterface.h"
 
WIFIDevice wifi;
 
const char* PC_SERVER_ADDRESS = "192.168.1.234";
uint16_t PC_PORT = 5222;
DigitalOut LED01(LED1);
DigitalOut LED02(LED2);
 
int main(void)
{   
    EthernetInterface eth;
    eth.init(); //Use DHCP
    wait(1);
    // set given SSID and PW as the highest priority  
    wifi.setNetwork("HTC820", "11111111", 0);
    wait(1);
    LED01 = 1;
    eth.connect(40000);
 
    LED02 = 1;
    TCPSocketConnection socket;     
    socket.connect(PC_SERVER_ADDRESS,PC_PORT); 
    char msg[] = "Hello World";
    socket.send(msg, sizeof(msg));
 
    socket.close();
    eth.disconnect();
    wifi.sleep();
}