kompost.ino
652 Bytes
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
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <Wire.h>
#include "wifi.h"
#include "sonar.h"
#include "pcf.h"
#include "mqtt.h"
#include "queue.h"
#include "pump.h"
#include "control.h"
unsigned int counter = 0;
void setup(void) {
Serial.begin(115200);
delay(100);
setup_wifi();
setup_sonar();
setup_pcf();
setup_mqtt();
setup_queue();
}
void loop(void) {
MDNS.update();
delay(500);
counter++;
loop_sonar(counter);
String liquidLevelAvgStr(liquid_level_avg());
mqttClient.publish(PREAMBLE T_SDIST, liquidLevelAvgStr );
loop_pcf();
loop_queue();
loop_control(counter);
next_sequence_step();
}