PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Sensor
libdht22
libdht22.c
1
15
//#define _TEST
16
17
#ifdef _TEST
18
#include "
simpletools.h
"
19
#else
20
#include <propeller.h>
21
#endif
22
23
#include "
dht22.h
"
24
25
int
main
() {
26
27
#ifdef _TEST
28
29
while
(1) {
30
int
t, h, c;
31
c =
dht22_read
(2);
32
t =
dht22_getTemp
(
FAHRENHEIT
);
33
h =
dht22_getHumidity
();
34
35
print
(
"chk = %d, temp = %.1f, hum = %.1f\r"
, c, t / 10.0, h / 10.0);
36
pause
(250);
37
}
38
39
#endif
40
41
}
42
dht22.h
This Propeller C library was created for the DHT22 temperature and humidity sensor module.
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
print
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
main
int main(void)
Definition:
GraphicsTest.c:20
FAHRENHEIT
#define FAHRENHEIT
Definition:
bme680.h:38
dht22_getTemp
int dht22_getTemp(char temp_units)
Retrieves the last temperature reading made by the dht22_read() function.
Definition:
dht22.c:36
dht22_getHumidity
int dht22_getHumidity()
Retrieves the last humidity reading made by the dht22_read() function.
Definition:
dht22.c:47
dht22_read
char dht22_read(int dht_pin)
Triggers a reading of the temperature and relative humidity from the sensor module.
Definition:
dht22.c:53
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17