Basic example that demonstrates functionalities of the BMC 150 SiP.

Dependencies:   adc52832_common mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002  *  Something nice =)
00003  *  Jurica Resetar @ aconno.de
00004  *
00005  */
00006 
00007 #include "mbed.h"
00008 #include "bmc150.h"
00009 #include "acd52832_bsp.h"
00010 #include "utilities.h"
00011 
00012 #define SPI_MISO        (p17)
00013 #define SPI_MOSI        (p18)
00014 #define SPI_CLK         (p20)
00015 #define BMC150_SPI_CS   (p19)
00016 
00017 #define VCC_ON_PIN      (p25)
00018 
00019 DigitalOut bmcCs(BMC150_SPI_CS);
00020 DigitalOut vccOn(VCC_ON_PIN);
00021 DigitalOut readyLED(PIN_LED_RED);
00022 SPI spi(SPI_MOSI, SPI_MISO, SPI_CLK); // mosi, miso, sclk
00023 BMC150 bmc(spi, bmcCs);
00024 
00025 int main(){
00026     uint8_t temperature;
00027     readyLED = 0;
00028     vccOn = 1; // Turn VCC_ON on for BMC150
00029     wait_ms(100);
00030     readyLED = 1;
00031     
00032     temperature = bmc.readTemperature();
00033     
00034 }