File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 6
6
#include < Adafruit_BME280.h>
7
7
#include < SparkFunTMP102.h>
8
8
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
12
16
13
17
// Web server
14
- ESP8266WebServer webServer (80 );
18
+ ESP8266WebServer webServer (WEB_SERVER_PORT );
15
19
16
20
// Sensors
17
- TSL2561 tsl2561 (0x39 );
21
+ TSL2561 tsl2561 (I2C_ADDR_TSL2561 );
18
22
Adafruit_BME280 bme280;
19
- TMP102 tmp102 (0x48 );
23
+ TMP102 tmp102 (I2C_ADDR_TMP102 );
20
24
21
25
void setup ()
22
26
{
@@ -89,9 +93,9 @@ void setupWiFi()
89
93
{
90
94
Serial.println (" [WiFi] Setup" );
91
95
Serial.print (" [WiFi] Connecting to: " );
92
- Serial.println (ssid );
96
+ Serial.println (WIFI_SSID );
93
97
94
- WiFi.begin (ssid, password );
98
+ WiFi.begin (WIFI_SSID, WIFI_PASS );
95
99
while (WiFi.status () != WL_CONNECTED)
96
100
{
97
101
delay (200 );
@@ -141,7 +145,7 @@ void setupSensorBME280()
141
145
Serial.println (" [BME280] Setup" );
142
146
Serial.print (" [BME280] Connecting.." );
143
147
144
- while (!bme280.begin (0x76 ))
148
+ while (!bme280.begin (I2C_ADDR_BME280 ))
145
149
{
146
150
delay (200 );
147
151
Serial.print (" ." );
You can’t perform that action at this time.
0 commit comments