STM32 (Bluepill) with i2c bme280


Sample code stm32duino upload via stlink

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

Adafruit_BME280 bme;

void setup() 
{
    Serial.begin(115200);
    bme.begin(0x76); //i2c address must declare,or try i2c scanner first
}
void loop() 
{
    Serial.print("Temperat: ");   
    Serial.println(bme.readTemperature(),1);
    Serial.print("Humidity: ");
    Serial.println(bme.readHumidity(),1);
    Serial.print("Pressure: ");     
    Serial.println((bme.readPressure()/100),1);              
    delay(1000);
}

Ditunggu komennya ...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.