-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloop functions.ino
48 lines (42 loc) · 1.45 KB
/
loop functions.ino
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
void printValues() {
// used this function for debugging
extern float temperature;
extern float pressure;
extern float humidity;
temperature = bme.readTemperature();
pressure = (bme.readPressure() / 100.0F);
humidity = bme.readHumidity();
Serial.println("--------------------------------");
printVariable("Temperature = ", temperature, "*C");
printVariable("Pressure = ", pressure, "hPa");
printVariable("Humidity = ", humidity, "%");
Serial.println("--------------------------------");
printVariable("setpoint = ", setpoint, "*C");
printVariable("previousError = ", previousError, "");
printVariable("Kproportional = ", Kproportional, "");
printVariable("Kintegral = ", Kintegral, "");
printVariable("Kderivative = ", Kderivative, "");
Serial.println("--------------------------------");
printVariable("send_interval = ", send_interval, "");
printVariable("pid_interval = ", pid_interval, "");
Serial.println("--------------------------------");
publish_temperature(temperature);
publish_pressure(pressure);
publish_humidity(humidity);
}
void send_measurements() {
printValues();
/*
if (millis() >= nextExecution) {
// Execute the function
printValues();
// Update the time for the next execution
nextExecution = millis() + interval;
}
*/
}
void printVariable(String prefix, float message, String postfix) {
Serial.print(prefix);
Serial.print(message);
Serial.println(postfix);
}