Skip to content

Commit 63cb53b

Browse files
Changed WiFi code.
1 parent 52a97de commit 63cb53b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

ESP8266-temp-server.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,19 @@
88

99
#include "index_htm.h"
1010
#include "logs_htm.h"
11+
#include "wifi_credentials.h" // change your WiFi settings in this file
1112

1213
#define ONE_WIRE_BUS D1
14+
#define ONBOARD_LED D4
1315

1416
#define TZ 1 // (utc+) TZ in hours
1517
#define DST_MN 60 // use 60mn for summer time in some countries
1618
#define TZ_MN ((TZ)*60)
1719
#define TZ_SEC ((TZ)*3600)
1820
#define DST_SEC ((DST_MN)*60)
1921

20-
const char WIFISSID[] = "yourSSID";
21-
const char WIFIPSK[] = "yourPSK";
22-
23-
const uint8_t ONBOARD_LED = 2;
2422
const float SENSOR_ERROR = -273.15;
2523

26-
AsyncWebServer server(80);
27-
2824
float currentTemp = SENSOR_ERROR;
2925
bool dstStatus = true;
3026

@@ -40,7 +36,10 @@ void setup(void)
4036
WiFi.mode( WIFI_STA );
4137
if ( !connectWifi() )
4238
{
43-
Serial.println( "No WiFi!" );
39+
Serial.println( "No WiFi! Check 'wifi_credentials.h'" );
40+
delay(100);
41+
Serial.end();
42+
pinMode( ONBOARD_LED, OUTPUT );
4443
while ( true )
4544
{
4645
digitalWrite( ONBOARD_LED, LOW );
@@ -52,6 +51,7 @@ void setup(void)
5251

5352
Serial.println( WiFi.localIP().toString() );
5453

54+
static AsyncWebServer server(80);
5555
static const char * HTML_HEADER = "text/html";
5656

5757
server.on( "/", HTTP_GET, [] ( AsyncWebServerRequest * request )

wifi_credentials.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#define WIFISSID "yourSSID"
2+
#define WIFIPSK "yourPSK"
3+

0 commit comments

Comments
 (0)