Skip to content

Instantly share code, notes, and snippets.

@netmaniac
Last active December 8, 2017 10:58
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 netmaniac/a54cb5ecae29e7572bc36297146a7f29 to your computer and use it in GitHub Desktop.
Save netmaniac/a54cb5ecae29e7572bc36297146a7f29 to your computer and use it in GitHub Desktop.
/***************************************************************************
Pogodełko - mini stacja pogodowa
https://nettigo.pl/products/pogodelko-twoja-pierwsza-stacja-pogodowa-z-wifi
v 1.0
***************************************************************************/
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#define BMP_SCK 13
#define BMP_MISO 12
#define BMP_MOSI 11
#define BMP_CS D4
//Adafruit_BMP280 bme; // I2C
Adafruit_BMP280 bme(BMP_CS); // hardware SPI
//Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);
#include <LiquidCrystal_PCF8574.h>
LiquidCrystal_PCF8574 lcd(0x27); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup() {
Serial.begin(9600);
Serial.println(F("BMP280 test"));
delay(100);
lcd.begin(16, 2); // initialize the lcd
lcd.setBacklight(1);
if (!bme.begin()) {
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
delay(1);
lcd.print("Brak BMP280");
while (1) {delay(1000); Serial.println("TICK");};
}
Serial.println("Init done");
}
void loop() {
Serial.print("Temperature = ");
Serial.print(bme.readTemperature());
Serial.println(" *C");
lcd.setCursor(0,0);
lcd.print(bme.readTemperature());
lcd.print(" C ");
Serial.print("Pressure = ");
Serial.print(bme.readPressure());
Serial.println(" Pa");
lcd.setCursor(0,1);
lcd.print(bme.readPressure()/100);
lcd.print(" hPa ");
Serial.print("Approx altitude = ");
Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase
Serial.println(" m");
Serial.println();
delay(2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment