ESP8266 send state of D7 to Adafruit

Hi,

I’m trying to get my ESP8266(NodeMCU or Wemos D1Mini) to publish the state of pin D7(high or low) to Adafruit. In every example I’ve looked at, the WiFi username and password are defined and look similar to this -

#include <ESP8266WiFi.h>
#include "AdafruitIO_WiFi.h"
 
#define WIFI_SSID       "YOUR SSID HERE"
#define WIFI_PASS       "YOUR WIFI PASSWORD HERE"
 
#define IO_USERNAME    "YOUR USERNAME HERE"
#define IO_KEY         "YOUR AIO KEY HERE"
 
// Connect to Wi-Fi and Adafruit IO handle
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);

I don’t have that info defined in mine. It starts up as an access point, credentials are entered, then reboots as client. Once that’s done, want it to connect to Adafruit and publish the state of pin D7.

Does anyone know how I can do that?

Thank you!
Frank

Maybe WiFiManager as a start?

Yeah, that what I currently use and it works great. My problem is then connecting to Adafruit. I can’t figure out how to connect using only my IO username and key. It also wants me to define SSID and password, which changes, so can’t be hard coded-

AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);

I’m sure it’s a simple solution, I’m just new to all this.
Thank you

You can pass all those arguments as c-strings (aka null-terminated character arrays) to the AdafruitIO_WiFi class’s constructor.

Thanks. I think I have an idea of what you’re suggesting. Don’t know how to do that , but it gives me something to research. Appreciate your help!