-
-
Save Robotto/5daea1ef82d7e6c5b34c2da8c510ddd1 to your computer and use it in GitHub Desktop.
Connect to eduroam with an ESP8266
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <ESP8266WiFi.h> | |
#include "wpa2_enterprise.h" | |
char username[] = "mrnm@aarhustech.dk"; //skolemail | |
char password[] = "MyEAPPassword"; | |
char ssid[] = "eduroam"; //Don't change this. | |
void setup() | |
{ | |
Serial.begin(115200); | |
///////// CONFIGURE ////////// | |
wifi_set_opmode(STATION_MODE); | |
struct station_config wifi_config; | |
memset(&wifi_config, 0, sizeof(wifi_config)); | |
strcpy((char *)wifi_config.ssid, ssid); | |
wifi_station_set_config(&wifi_config); | |
// DISABLE authentication using certificates - But risk leaking your password to someone claiming to be "eduroam" | |
wifi_station_clear_cert_key(); | |
wifi_station_clear_enterprise_ca_cert(); | |
// Authenticate using username/password | |
wifi_station_set_wpa2_enterprise_auth(1); | |
wifi_station_set_enterprise_identity((uint8 *)username, strlen(username)); | |
wifi_station_set_enterprise_username((uint8 *)username, strlen(username)); | |
wifi_station_set_enterprise_password((uint8 *)password, strlen(password)); | |
///////// EXECUTE///////// | |
wifi_station_connect(); | |
while (WiFi.status() != WL_CONNECTED) {Serial.println("Wifi connecting..."); delay(500);} | |
///////// REPORT ////////// | |
Serial.println("IP address: "); // Print wifi IP addess | |
Serial.println(WiFi.localIP()); | |
} | |
void loop() | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment