Public Documentation
  • Introduction
  • Getting started
    • Introduction
    • 1. Welcome Page
    • 2. Introduction (Beginner's Guide)
  • Portal Tools
    • Blocko
      • Ůvod do blocka
      • Flip-flop
      • REST-API bloček
    • Grid
      • Úvod do GRID
      • Základní Tlačítko (základy GRID)
      • vylepšený Přepínač (stylování a pokročilé možnosti GRID)
      • text generátor button (messeage type, two elements one widget)
      • graf (pokročilé funkce GRID)
      • Slider (User class v GRIDu)
      • Styly a jejich použití
  • Cloud
    • Cloud
    • Instancies
    • Rest-Api
  • General
    • What we plan
  • Hardware a programování
    • Úvod
      • Nahrání prvního programu
    • Konektivita
      • Specifikace zdroje internetu
      • GSM
      • 6LowPAN
      • Komunikace s portálem
      • Přepínání mezi servery
    • Hardware
      • Základní jednotky
        • IODAG3E
          • Rozhraní a periférie
          • Konektor X a Y
          • Napájení
          • Připojení zdroje k VBAT
          • Paměti
          • Technické specifikace
          • Schémata
        • IODAG3L
      • Rozšiřující moduly
        • GSM shield
        • LED shield
        • Relay shield
        • RFID shield
        • Ultrasonic shield
        • Meteo shield
        • Movement shield
        • PIR shield
        • RGB Displej shield
        • Serial shield
      • Ostatní
        • DevKitG3
          • Schéma
        • TK3G
          • Schéma
        • ZPPG3
          • Schéma
        • WEXP
    • Programování HW
      • Architektura FW
        • Aktualizace FW
        • Autobackup
      • Struktura programu
      • Byzance API
        • Vstupy a výstupy do Portálu
        • Callback Busy
        • Odložený restart
        • Callbacky připojení
        • Uživatelská makra
      • MBED API
        • Vstupy a výstupy
        • Komunikační rozhraní
        • Časování
        • RTOS
      • Knihovny
        • DHT
        • DS1820
        • Dali
        • EdgeStruct
        • I2CWrapper
        • Knock
        • MFRC522
        • MFRC522::MIFARE_Key
        • MPU9150
        • ms5637
        • OneWire
        • PCA9536
        • RGB_matrix
        • RollerDrive
        • SHT21
        • ST7565
        • Servo
        • TCA6424A
        • TLC59116
        • TripleSevenSeg
        • MFRC522::Uid
        • WS2812
        • WakeUp
      • Offline programování
        • Vlastní IDE
        • Upload kódu z GUI
        • Upload kódu z konzole
        • Upload kódu Drag&drop
    • Tutoriály
      • Datum a čas (RTC)
      • Komunikace po sériové lince (UART) s PC
        • Konfigurace sériové linky v PC
        • Programování sériové linky
      • Základní tutoriály
        • Digital Read
        • Analog Read/Write
        • PWM Fade
        • Timer/Ticker
        • State Change Detection
        • Ovládání LED modulu
        • BusOut
        • HC-SR04 Senzor
      • Pokročilé
    • Správa a diagnostika
      • Zdroj restartu
      • LED modul
      • Identifikace zařízení
      • Monitoring parametrů
      • Vytížení zařízení
      • Webové rozhraní
        • Základní přehled
        • Správce firmware
        • Vlákna
        • Definované vstupy
        • Konfigurace MQTT
        • Nastavení
      • Bootloader
        • Režimy bootloaderu
        • Command mód
        • Další vlastnosti bootloaderu
      • Webová konzole
      • Konfigurace zařízení
        • Confighash
      • Omezení konfigurace
        • Konfigurace
        • Binárky
        • Omezení MQTT
        • Lowpan
    • Knowledge base
      • Náhodná čísla
      • Watchdog
      • Paměť RAM
Powered by GitBook
On this page
  • class SHT21
  • Public Functions
  • Detailed Description
  • Public Functions Documentation
  • define SHT_PREC_1214 0x00
  • define SHT_PREC_0812 0x01
  • define SHT_PREC_1013 0x80
  • define SHT_PREC_1111 0x81
  1. Hardware a programování
  2. Programování HW
  3. Knihovny

SHT21

PreviousRollerDriveNextST7565

Last updated 6 years ago

class SHT21

Driver for I2C temperature and humidity sensor.

Public Functions

Type

Name

float

float

int

int

Detailed Description

Connection class, utilizing a I2C interface Example:

#include "mbed.h"
#include "SHT21_ncleee.h"


DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
I2C i2c(p28,p27);
SHT21 sht(&i2c);

int main() 
{

    pc.printf("Hello World...\n\tTesting temperature Sensor\n");

    int temperature = sht.readTemp();

    pc.printf("Temperature is: %d \n", temperature);

    pc.printf("Experiment complete...\n");

}

Public Functions Documentation

SHT21::SHT21 (
    I2C * i2c
)

Parameters:

  • *i2c a pointer to the i2c interface that is used for communication

  • frequency - I2C frequency

float SHT21::readTemp ()

Read the temperature value from the sensor Involves triggering the measuring unit then waiting for 100ms for the measuring to complete before reading the temperature

Parameters:

  • returns a value representing the temperature in degrees centigrade

float SHT21::readHumidity ()

Read the humidity value from the sensor Involves triggering the measuring unit then waiting for 100ms for the measuring to complete before reading the humidity

Parameters:

  • returns the percentage humidity

int SHT21::reset ()

Perform a soft-reset of the sensor unit.

int SHT21::setPrecision (
    char precision
)

Set the precision of the measuring //Data precision settings //RH 12 T 14 - default

define SHT_PREC_1214 0x00

//RH 8 T 10

define SHT_PREC_0812 0x01

//RH 10 T 13

define SHT_PREC_1013 0x80

//RH 11 T 11

define SHT_PREC_1111 0x81

Parameters:

  • precision - the precision, refer to above or datasheet.

The documentation for this class was generated from the following file: D:/w/hw-libs/\_libs\_/libraries/SHT21\_ncleee.h

(I2C * i2c)

()

()

()

(char precision)

function

Constructor - create a connection to a temperature and humidity sensor through an I2C interface

function

function

function

function

SHT21
SHT21
SHT21
More...
SHT21
readTemp
readHumidity
reset
setPrecision
SHT21
readTemp
readHumidity
reset
setPrecision