Delta / Mbed 2 deprecated NNN40_WiFi_SoftAP

Dependencies:   WIFI_API_32kRAM mbed

Fork of NNN40_WiFi by Delta

main.cpp

Committer:
Marcomissyou
Date:
2015-03-23
Revision:
3:65c5fce3a471
Parent:
1:f8f52bde7864
Child:
7:c497e792660d

File content as of revision 3:65c5fce3a471:

#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("HTCSV", "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();
}