Internet of Things project / Transferring SSID and password

Hey everybody,

could sombebody help me out with the following problem.
I would like

  1. To open an WiFi-AccessPoint with my NodeMCU ESP8266
  2. Enter my home SSID + password
  3. Safe this so later without changing something in the code my microcontroller could log data over the entnered SSID + password WIfi Station

The problem is. I can run the Access Point

#include <ESP8266WiFi.h>
#include <WiFiClient.h> 
#include <ESP8266WebServer.h>

/* Set these to your desired credentials. */
const char *ssid = "ESPap";
const char *password = "thereisnospoon";

ESP8266WebServer server(80);

/* Just a little test message.  Go to http://192.168.4.1 in a web browser
 * connected to this access point to see it.
 */
void handleRoot() {
 server.send(200, "text/html", "<h1>You are connected</h1>");
  
}

void setup() {
 delay(1000);
 Serial.begin(115200);
 Serial.println();
 Serial.print("Configuring access point...");
 /* You can remove the password parameter if you want the AP to be open. */
 WiFi.softAP(ssid, password);

 IPAddress myIP = WiFi.softAPIP();
 Serial.print("AP IP address: ");
 Serial.println(myIP);
 server.on("/", handleRoot);
 server.begin();
 Serial.println("HTTP server started");
}

void loop() {
 server.handleClient();
}

But how can I enter an inputbox is this http ?
How can the inputbox enry be safed and later be used.
Is this all happening in the setup section ?

The loop section is my data checking and logging right ?
That´s how I did it without Wifi Access Point. :slight_smile:

#include <ESP8266WiFi.h>
String deviceId = "v2BF998C4A53E641";
String deviceIdE = "v22A9CF37D02083B";
const char* logServer = "api.pushingbox.com";

//const char* ssid = "Brni";
//const char* password = "9897";

Cheers and Thanks for any help

You could look here for a ready made solution to entering wifi credentials into an ESP8266 / Arduino

Thanks for the answer. I haven´t found this particularly.

Still somehow I do not get it.

#include <ESP8266WiFi.h>          //ESP8266 Core WiFi Library (you most likely already have this in your sketch)

#include <DNSServer.h>            //Local DNS Server used for redirecting all requests to the configuration portal
#include <ESP8266WebServer.h>     //Local WebServer used to serve the configuration portal
#include <WiFiManager.h>          //https://github.com/tzapu/WiFiManager WiFi Configuration Magic
const char *ssid = "ESPap";
const char *password = "test";


void setup() {
  // put your setup code here, to run once:
WiFiManager wifiManager;
wifiManager.autoConnect("ssid", "password");
}

void loop() {
  // put your main code here, to run repeatedly:

}

Nothing happens :confused:
I expected it to open up with a prepared window to enter something. But nothing :confused:
Any advices or code example, which was realized with NodeMCU ESP8266 :slight_smile: [/code]

Remove quotes from autoConnect parameters.

wifiManager.autoConnect(ssid, password);