Skip to content

Commit db63f52

Browse files
committed
🎨 Moved some constants to the top as definitions
1 parent 163d389 commit db63f52

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

esp8266.ino

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,21 @@
66
#include <Adafruit_BME280.h>
77
#include <SparkFunTMP102.h>
88

9-
// WiFi configuration
10-
const char *ssid = "";
11-
const char *password = "";
9+
// Configuration
10+
#define WIFI_SSID ""
11+
#define WIFI_PASS ""
12+
#define WEB_SERVER_PORT 80
13+
#define I2C_ADDR_TSL2561 0x39
14+
#define I2C_ADDR_BME280 0x76
15+
#define I2C_ADDR_TMP102 0x48
1216

1317
// Web server
14-
ESP8266WebServer webServer(80);
18+
ESP8266WebServer webServer(WEB_SERVER_PORT);
1519

1620
// Sensors
17-
TSL2561 tsl2561(0x39);
21+
TSL2561 tsl2561(I2C_ADDR_TSL2561);
1822
Adafruit_BME280 bme280;
19-
TMP102 tmp102(0x48);
23+
TMP102 tmp102(I2C_ADDR_TMP102);
2024

2125
void setup()
2226
{
@@ -89,9 +93,9 @@ void setupWiFi()
8993
{
9094
Serial.println("[WiFi] Setup");
9195
Serial.print("[WiFi] Connecting to: ");
92-
Serial.println(ssid);
96+
Serial.println(WIFI_SSID);
9397

94-
WiFi.begin(ssid, password);
98+
WiFi.begin(WIFI_SSID, WIFI_PASS);
9599
while (WiFi.status() != WL_CONNECTED)
96100
{
97101
delay(200);
@@ -141,7 +145,7 @@ void setupSensorBME280()
141145
Serial.println("[BME280] Setup");
142146
Serial.print("[BME280] Connecting..");
143147

144-
while (!bme280.begin(0x76))
148+
while (!bme280.begin(I2C_ADDR_BME280))
145149
{
146150
delay(200);
147151
Serial.print(".");

0 commit comments

Comments
 (0)