-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.c
86 lines (75 loc) · 2.02 KB
/
Main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//==============================================================================
//
// main.c
//
//
//==============================================================================
// FILE INFORMATION
//==============================================================================
//
// Source:
//
// Project: Humidity and temperature monitoring
//
// Author: M.Shahzad
//
// Date: 20/03/2023
//
// Revision: 1.0
//
//==============================================================================
// FILE DESCRIPTION
//==============================================================================
//
//! \file
//! This module takes care of the
//
//==============================================================================
// REVISION HISTORY
//==============================================================================
// Revision: 1.0
//
//
//==============================================================================
// INCLUDES
//==============================================================================
#include "main.h"
//==============================================================================
//
// void main(void)
//
// Author: M. Shahzad
// Date: 06/08/2021
//
//! This function takes care of initlization and fetching DHT11 temperature and
//! humidity vlaues and print on the serial console
//
//==============================================================================
void main()
{
// todo digital
UART1_Init(9600);
UART1_Write_Text("System boot up \r");
while (1)
{
switch (dht22_S1_function(1))
{
case dht22_ok:
floattostr_(dht22_S1_object.temperature_, txt, 1);
UART1_Write_Text("Temp1:");
UART1_Write_Text(txt);
floattostr_(dht22_S1_object.humedad_, txt, 1);
UART1_Write_Text(" Hume1:");
UART1_Write_Text(txt);
break;
case dht22_errorcheck_sum:
UART1_Write_Text("Eror \r");
break;
case dht22_noresponse:
UART1_Write_Text("No respose \r");
break;
}
UART1_Write_Text("\r");
delay_ms(3000); // 3 seconds delay
}
}