Mega 2650-ESP01S Wifi Enterprise

Dear Friends,

I managed to connect to thingspeak server using Mega 2650-ESP01S using my home wifi that only requires SSID and password.

But when I tried to use my office wifi (Enterprise WPA2: SSID, username, and password), I do not know on how to program the Mega 2650 to include the username to match the Enterprise WPA2 configuration.
Kindly give me suggestion. Thank you

Attached is the code that works for my home WiFi.

#include <dht11.h>
#include <WiFiEsp.h>
#include <WiFiEspClient.h>
#include <WiFiEspServer.h>
#include <WiFiEspUdp.h>

#include <ThingSpeak.h>


#define SECRET_SSID "XXXX"    // replace MySSID with your WiFi network name
#define SECRET_PASS "XXXXX"  // replace MyPassword with your WiFi password

#define SECRET_CH_ID XYX     // replace 0000000 with your channel number
#define SECRET_WRITE_APIKEY "XYX"   // replace XYZ with your channel write API Key


char ssid[] = SECRET_SSID;   // your network SSID (name) 
char pass[] = SECRET_PASS;   // your network password
int keyIndex = 0;            // your network key Index number (needed only for WEP)


WiFiEspClient  client;

dht11 DHT;
#define DHT11_PIN A0
float humi;
float temp;

// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(19, 18); // RX, TX
#define ESP_BAUDRATE  19200
#else
#define ESP_BAUDRATE  115200
#endif


unsigned long myChannelNumber = SECRET_CH_ID;
const char * myWriteAPIKey = SECRET_WRITE_APIKEY;


// Initialize our values
int number1 = 0;
int number2 = random(0,100);
int number3 = random(0,100);
int number4 = random(0,100);



String myStatus = "";

void setup() {
  //Initialize serial and wait for port to open
  Serial.begin(115200);  // Initialize serial
  
  // initialize serial for ESP module  
  setEspBaudRate(ESP_BAUDRATE);


  Serial.print("Searching for ESP8266..."); 
  // initialize ESP module
  WiFi.init(&Serial1);

  // check for the presence of the shield
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue
    while (true);
  }
  Serial.println("found it!");
   
  ThingSpeak.begin(client);  // Initialize ThingSpeak
}

void loop() {

  // Connect or reconnect to WiFi
  if(WiFi.status() != WL_CONNECTED){
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(SECRET_SSID);
    while(WiFi.status() != WL_CONNECTED){
      WiFi.begin(ssid, pass);  // Connect to WPA/WPA2 network. Change this line if using open or WEP network
      Serial.print(".");
      delay(5000);     
    } 
    Serial.println("\nConnected.");
  }
DHT.read(DHT11_PIN);
humi = DHT.humidity;
temp = DHT.temperature;
  Serial.print("H:");
  Serial.print(humi);
  Serial.println("%");
  Serial.print("T:");
  Serial.print(temp);
  Serial.println(" C");
  
// set the fields with the values
  ThingSpeak.setField(1, number1);
  ThingSpeak.setField(2, number2);
  ThingSpeak.setField(3, number3);
  ThingSpeak.setField(4, number4);
  ThingSpeak.setField(5,temp);
  ThingSpeak.setField(6,humi);
  

  // figure out the status message
  if(number1 > number2){
    myStatus = String("field1 is greater than field2"); 
  }
  else if(number1 < number2){
    myStatus = String("field1 is less than field2");
  }
  else{
    myStatus = String("field1 equals field2");
  }
  
  // set the status
  ThingSpeak.setStatus(myStatus);
  
  // write to the ThingSpeak channel
  int x = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
  if(x == 200){
  //  Serial.println("Channel update successful.");
  }
  else{
    Serial.println("Problem updating channel. HTTP error code " + String(x));
  }
  
  // change the values
  number1++;
  if(number1 > 99){
    number1 = 0;
  }
  number2 = random(0,100);
  number3 = random(0,100);
  number4 = random(0,100);
  
  delay(1000); //
}

// This function attempts to set the ESP8266 baudrate. Boards with additional hardware serial ports
// can use 115200, otherwise software serial is limited to 19200.
void setEspBaudRate(unsigned long baudrate){
  long rates[6] = {115200,74880,57600,38400,19200,9600};

  Serial.print("Setting ESP8266 baudrate to ");
  Serial.print(baudrate);
  Serial.println("...");

  for(int i = 0; i < 6; i++){
    Serial1.begin(rates[i]);
    delay(100);
    Serial1.print("AT+UART_DEF=");
    Serial1.print(baudrate);
    Serial1.print(",8,1,0,0\r\n");
    delay(100);  
  }
    
  Serial1.begin(baudrate);
}

AT 2.1 supports WPA2 Enterprise.
my WiFiEspAT library works with AT 2.1
but I didn't have an opportunity to test WiFi.beginEnterprise
and the RTOS SDK AT 2.1 has more issues then the NONOS SDK AT firmwares 1.*