Naresh Krish
/
itracker-mbed-os-example-bme280
Sample program on how to use the LIS2MDL sensor on the RAKWirelss iTracker module
main.cpp@0:a8bfd25ff975, 2018-02-12 (annotated)
- Committer:
- knaresh89
- Date:
- Mon Feb 12 05:04:29 2018 +0000
- Revision:
- 0:a8bfd25ff975
Sample program on how to use the BME280 sensor on the RAKWirelss iTracker module
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
knaresh89 | 0:a8bfd25ff975 | 1 | #include "mbed.h" |
knaresh89 | 0:a8bfd25ff975 | 2 | #include "BME280_SPI.h" |
knaresh89 | 0:a8bfd25ff975 | 3 | #include "SEGGER_RTT.h" |
knaresh89 | 0:a8bfd25ff975 | 4 | |
knaresh89 | 0:a8bfd25ff975 | 5 | // main() runs in its own thread in the OS |
knaresh89 | 0:a8bfd25ff975 | 6 | int main() { |
knaresh89 | 0:a8bfd25ff975 | 7 | BME280_SPI sensor(p3, p5, p4, p2); // mosi, miso, sclk, cs |
knaresh89 | 0:a8bfd25ff975 | 8 | |
knaresh89 | 0:a8bfd25ff975 | 9 | while (true) { |
knaresh89 | 0:a8bfd25ff975 | 10 | SEGGER_RTT_printf(0, "%2.2f degC, %04.2f hPa, %2.2f %%\n", sensor.getTemperature(), sensor.getPressure(), sensor.getHumidity()); |
knaresh89 | 0:a8bfd25ff975 | 11 | wait(5.0); |
knaresh89 | 0:a8bfd25ff975 | 12 | } |
knaresh89 | 0:a8bfd25ff975 | 13 | } |
knaresh89 | 0:a8bfd25ff975 | 14 |