![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Temperatur und Luffeuchtigkeit ueber I^2 einlesen und an der serielen Schnittstelle ausgeben
main.cpp
- Committer:
- happy_alien
- Date:
- 2020-01-13
- Revision:
- 3:ab1d4af507d1
- Parent:
- 2:538939bfd629
File content as of revision 3:ab1d4af507d1:
#include "mbed.h" #include "Si7021.h" I2C env_i2c(PC4, PC5); // einlesen des int main() { int32_t temperature; uint32_t humidity; /* Measure temperature and humidity */ if(rhtsensor_en) { rhtSensor->measure(); rhtSensor->measure(); temperature = rhtSensor->get_temperature(); humidity = rhtSensor->get_humidity(); printf("Si7021:\r\n"); printf("T: %ld.%03ld degC\r\n", temperature/1000, abs(temperature%1000)); printf("h: %ld.%03ld %%\r\n", humidity/1000, humidity%1000); } } }