Apostolos Fanakis
6 years ago
2 changed files with 123 additions and 36 deletions
@ -0,0 +1,56 @@ |
|||
#ifndef TODO_FIND_COOL_NAME_FOR_PROJECT_H |
|||
#define TODO_FIND_COOL_NAME_FOR_PROJECT_H |
|||
|
|||
/* ===== INCLUDES ===== */ |
|||
#include <SevSeg.h> |
|||
#include <DHT.h> |
|||
|
|||
/* ===== DEFINITIONS ===== */ |
|||
// Type of DHT sensor used is 11
|
|||
#define DHTTYPE DHT11 |
|||
// Number of readings to average
|
|||
#define BUFFER_SIZE 24 |
|||
// Interval between readings in milliseconds
|
|||
#define SLEEP_INTERVAL 1000 |
|||
// Duration of average temperature display
|
|||
#define TEMPERATURE_DISPLAY_DURATION 2000 |
|||
// Number of digits on the display
|
|||
#define NUMBER_OF_DIGITS 4 |
|||
// Pin layout
|
|||
#define DHTPIN 2 |
|||
#define LOW_TEMP_LED_PIN 3 |
|||
#define HIGH_TEMP_LED_PIN 4 |
|||
#define RELAY_PIN 5 |
|||
#define DIGIT_1_PIN 14 |
|||
#define DIGIT_2_PIN 17 |
|||
#define DIGIT_3_PIN 18 |
|||
#define DIGIT_4_PIN 12 |
|||
#define SEGMENT_A_PIN 15 |
|||
#define SEGMENT_B_PIN 19 |
|||
#define SEGMENT_C_PIN 7 |
|||
#define SEGMENT_D_PIN 9 |
|||
#define SEGMENT_E_PIN 6 |
|||
#define SEGMENT_F_PIN 16 |
|||
#define SEGMENT_G_PIN 8 |
|||
#define DECIMAL_POINT_PIN 13 |
|||
// Temperature thresholds
|
|||
#define LOW_TEMP 28 |
|||
#define HIGH_TEMP 28 |
|||
|
|||
|
|||
/* ===== GLOBAL VARIABLES AND INITIALIZATIONS ===== */ |
|||
// Initializes DHT sensor
|
|||
DHT dht(DHTPIN, DHTTYPE); |
|||
// Instantiates a seven segment object
|
|||
SevSeg sevseg; |
|||
int temperatureReadingsCounter; |
|||
float temperatures[BUFFER_SIZE]; |
|||
float averageTemp = 0; |
|||
unsigned long displayTimeStart = 0; |
|||
|
|||
/* ===== FUNCTION DEFINITIONS ===== */ |
|||
void getNewSamples(); |
|||
float getNewTemp(); |
|||
float calcAverageTempAndReset(); |
|||
|
|||
#endif //TODO_FIND_COOL_NAME_FOR_PROJECT_H
|
Loading…
Reference in new issue