2024-07-13 23:48:32 -04:00
|
|
|
#include <Arduino.h>
|
|
|
|
#include <WiFi.h>
|
|
|
|
#include <WiFiClientSecure.h>
|
2024-07-14 00:18:25 -04:00
|
|
|
#include <Wire.h>
|
2024-07-13 23:48:32 -04:00
|
|
|
#include <Adafruit_BME280.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
Adafruit_BME280 bme;
|
|
|
|
|
|
|
|
void setup() {
|
2024-07-14 00:18:25 -04:00
|
|
|
Serial.begin(9600);
|
2024-07-13 23:48:32 -04:00
|
|
|
Serial.println();
|
|
|
|
Serial.println("Setting up GPIOs ...");
|
|
|
|
|
|
|
|
pinMode(LED_PIN, OUTPUT);
|
|
|
|
|
|
|
|
Serial.println("GPIO setup done");
|
|
|
|
|
2024-07-14 00:18:25 -04:00
|
|
|
Serial.println("Setting up BME280 sensor");
|
2024-07-14 00:25:02 -04:00
|
|
|
Wire.setPins(SDA_PIN, SCL_PIN);
|
2024-07-14 00:26:02 -04:00
|
|
|
Wire.begin();
|
2024-07-14 00:27:19 -04:00
|
|
|
//unsigned status = bme.begin(0x76); // 0x76
|
|
|
|
if (!bme.begin(0x76)) {
|
2024-07-13 23:48:32 -04:00
|
|
|
Serial.println("Could not find a valid BME/BMP280 sensor, check wiring!");
|
|
|
|
Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(),16);
|
|
|
|
Serial.print(" ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");
|
|
|
|
Serial.print(" ID of 0x56-0x58 represents a BMP 280,\n");
|
|
|
|
Serial.print(" ID of 0x60 represents a BME 280.\n");
|
|
|
|
Serial.print(" ID of 0x61 represents a BME 680.\n");
|
2024-07-14 00:18:25 -04:00
|
|
|
while (1) {
|
|
|
|
digitalWrite(LED_PIN, LOW);
|
|
|
|
delay(250);
|
|
|
|
digitalWrite(LED_PIN, HIGH);
|
|
|
|
delay(250);
|
|
|
|
}
|
2024-07-14 00:27:19 -04:00
|
|
|
}
|
2024-07-13 23:48:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
|
|
|
|
digitalWrite(LED_PIN, LOW);
|
|
|
|
delay(250);
|
|
|
|
digitalWrite(LED_PIN, HIGH);
|
|
|
|
delay(250);
|
|
|
|
digitalWrite(LED_PIN, LOW);
|
2024-07-14 00:18:25 -04:00
|
|
|
delay(250);
|
|
|
|
digitalWrite(LED_PIN, HIGH);
|
|
|
|
delay(750);
|
|
|
|
Serial.println("Main loop");
|
2024-07-13 23:48:32 -04:00
|
|
|
}
|