Skip to content

Instantly share code, notes, and snippets.

@solars

solars/test.ino Secret

Created June 24, 2018 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solars/1bebe10d0a9175a5876b1f3ea60aa6a6 to your computer and use it in GitHub Desktop.
Save solars/1bebe10d0a9175a5876b1f3ea60aa6a6 to your computer and use it in GitHub Desktop.
#include <Wire.h>
#include <Adafruit_BME280.h>
#include <ESP8266WiFi.h>
const char* ssid = "casablanca";
const char* password = "xxx";
WiFiClient client;
Adafruit_BME280 bme; // I2C
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
if (!bme.begin()) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
}
void loop() {
float t = bme.readTemperature();
float p = bme.readPressure();
float h = bme.readHumidity();
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" degrees Celcius Pressure: ");
Serial.print(p);
Serial.print(" Humidity: ");
Serial.print(h);
Serial.println("% send to Thingspeak");
delay(20000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment