Using BLE to control WIFI configuration as SSID and PW.
Dependencies: BLE_API WIFI_API_32kRAM mbed nRF51822
Fork of NNN40_WiFi by
BLE_WIFIControl enables user to setup Wifi connection via BLE link. Here is iPhone app that teaches you how to use this BLE_WIFIControl example. /media/uploads/Marcomissyou/ios_app_for_wifi_configure.pdf
main.cpp
- Committer:
- Marcomissyou
- Date:
- 2015-03-23
- Revision:
- 3:65c5fce3a471
- Parent:
- 1:f8f52bde7864
- Child:
- 7:5d82c92ec2a3
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();
}
