-->
Page 1 of 1

Trying to connect to WPA-PEAP without success

PostPosted: Thu Jul 20, 2017 12:27 pm
by rjo.rodrigues
Hardware: ESP-12E

Settings in IDE
Module: NodeMcu 1.0 (ESP-12E)
Flash Size: 4MB
CPU Frequency: 80Mhz
Upload Using: SERIAL


Sketch

extern "C" {
#include "user_interface.h"
#include "wpa2_enterprise.h"
}
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>

// SSID to connect to
static const char* ssid = "SSID";
// Username for authentification
static const char* username = "username";
// Password for authentification
static const char* password = "password";
const int ledPin = 0;


void setup() {
Serial.begin(115200);
pinMode(ledPin, OUTPUT);

Serial.print("Tryingonnect to ");
Serial.println(ssid);

wifi_station_disconnect();
struct station_config wifi_config;

memset(&wifi_config, 0, sizeof(wifi_config));
strcpy((char*)wifi_config.ssid, ssid);
strcpy((char*)wifi_config.password, password);
wifi_station_set_config(&wifi_config);



wifi_station_set_wpa2_enterprise_auth(1);
wifi_station_set_enterprise_username((uint8*)username, strlen(username));
wifi_station_set_enterprise_password((uint8*)password, strlen(password));
wifi_station_connect();


Serial.print("Status: ");
Serial.println(wifi_station_get_connect_status());


// Wait for connection AND IP address from DHCP
while (WiFi.status() != WL_CONNECTED) {
delay(2000);
Serial.println(WiFi.localIP());

}

} // setup



void loop() {

}