Martin Tran / Mbed 2 deprecated vlhkost

Dependencies:   mbed X_NUCLEO_IKS01A2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

Go to the documentation of this file.
00001 /**
00002  ******************************************************************************
00003  * @file    main.cpp
00004  * @author  Tran Minh Son
00005  * @version V1.0.0
00006  * @date    20-November-2019
00007  *          X_NUCLEO_IKS01A2
00008  
00009   ******************************************************************************
00010   * Program pro mereni atmosferickeho tlaku
00011 
00012 **/
00013 
00014 
00015 #include "mbed.h"                   //knihovny
00016 #include "XNucleoIKS01A2.h"
00017 static XNucleoIKS01A2 *mems_expansion_board = XNucleoIKS01A2::instance(D14, D15, D4, D5);  //Instance
00018 static HTS221Sensor *hum_temp = mems_expansion_board->ht_sensor; //nacteni prvku desky
00019 DigitalOut myled(LED1);
00020 
00021 
00022 
00023  int main()
00024  {
00025      uint8_t id;            //deklarace
00026      float value2;
00027      hum_temp->enable();  //povoleni senzoru
00028      printf("----------Atmosfericky Tlak----------\r\n");
00029      while(1)               //cyklus pro vypisovani hodnot
00030      {
00031          printf("<Values>");
00032          hum_temp->read_id(&id);      //mereni vlhkosti
00033          hum_temp->get_humidity(&value2);     //ziskani hodnot vlhkosti
00034          printf(" %f  </Values>\r\n",value2);         //vypis hodnot vlhkosti
00035          wait(2);                               //zpozdeni
00036          }
00037      
00038      
00039      }