Create config header
This commit is contained in:
parent
a70e802190
commit
548a89f824
2 changed files with 11 additions and 6 deletions
7
src/config.h
Normal file
7
src/config.h
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#ifndef CONFIG_H_
|
||||||
|
#define CONFIG_H_
|
||||||
|
|
||||||
|
#define WIFI_SSID "REPLACE_WITH_YOUR_SSID"
|
||||||
|
#define WIFI_PASSWORD "REPLACE_WITH_YOUR_PASSWORD"
|
||||||
|
|
||||||
|
#endif // CONFIG_H_
|
10
src/main.cpp
10
src/main.cpp
|
@ -3,9 +3,7 @@
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <AsyncElegantOTA.h>
|
#include <AsyncElegantOTA.h>
|
||||||
|
#include "config.h"
|
||||||
const char* ssid = "REPLACE_WITH_YOUR_SSID";
|
|
||||||
const char* password = "REPLACE_WITH_YOUR_PASSWORD";
|
|
||||||
|
|
||||||
class App {
|
class App {
|
||||||
public:
|
public:
|
||||||
|
@ -21,7 +19,7 @@ public:
|
||||||
M5.Display.setFont(&fonts::Font0);
|
M5.Display.setFont(&fonts::Font0);
|
||||||
M5.Display.setEpdMode(epd_text);
|
M5.Display.setEpdMode(epd_text);
|
||||||
M5.Display.setCursor(0, 10);
|
M5.Display.setCursor(0, 10);
|
||||||
M5.Display.printf("SSID: %s\n", ssid);
|
M5.Display.printf("SSID: %s\n", WIFI_SSID);
|
||||||
M5.Display.printf("IP Address: %s\n", WiFi.localIP().toString());
|
M5.Display.printf("IP Address: %s\n", WiFi.localIP().toString());
|
||||||
M5.Display.printf("\n\n");
|
M5.Display.printf("\n\n");
|
||||||
M5.Display.printf("Web server running on port 80\n");
|
M5.Display.printf("Web server running on port 80\n");
|
||||||
|
@ -96,7 +94,7 @@ void setup(void) {
|
||||||
M5.Display.endWrite();
|
M5.Display.endWrite();
|
||||||
|
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.begin(ssid, password);
|
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
|
||||||
// Wait for connection
|
// Wait for connection
|
||||||
|
@ -106,7 +104,7 @@ void setup(void) {
|
||||||
}
|
}
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
Serial.print("Connected to ");
|
Serial.print("Connected to ");
|
||||||
Serial.println(ssid);
|
Serial.println(WIFI_SSID);
|
||||||
Serial.print("IP address: ");
|
Serial.print("IP address: ");
|
||||||
Serial.println(WiFi.localIP());
|
Serial.println(WiFi.localIP());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue