Hello program for BME280_SPI library

Dependencies:   BME280_SPI mbed

Fork of BME280_Hello by Toyomasa Watarai

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "BME280_SPI.h"
00003 
00004 Serial pc(USBTX, USBRX);
00005 #if defined(TARGET_LPC1768)
00006 BME280_SPI sensor(p5, p6, p7, p8); // mosi, miso, sclk, cs
00007 #elif defined(TARGET_NUCLEO_F401RE)
00008 BME280_SPI sensor(D4, D5, D3, D7); // mosi, miso, sclk, cs
00009 #endif
00010 
00011 int main() {
00012     
00013     while(1) {
00014         pc.printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", sensor.getTemperature(), sensor.getPressure(), sensor.getHumidity());
00015         wait(1);
00016     }
00017 }