|
|
|
@ -4,6 +4,7 @@
|
|
|
|
|
|
|
|
|
|
#include "hardware/i2c.h"
|
|
|
|
|
#include "pico/stdlib.h"
|
|
|
|
|
#include "../modules/pico-onewire/api/one_wire.h"
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "ds18b20.h"
|
|
|
|
@ -31,7 +32,10 @@ int main() {
|
|
|
|
|
myLCD.clear();
|
|
|
|
|
|
|
|
|
|
// Initialize the temp sensor
|
|
|
|
|
// DS18B20 ds = DS18B20(pio0, DS18B20_PIN);
|
|
|
|
|
One_wire oneWire(DS18B20_PIN);
|
|
|
|
|
oneWire.init();
|
|
|
|
|
rom_address_t address{};
|
|
|
|
|
oneWire.single_device_read_rom(address);
|
|
|
|
|
|
|
|
|
|
// Initialize the relais
|
|
|
|
|
Relais relais(RELAIS_PIN);
|
|
|
|
@ -51,9 +55,8 @@ int main() {
|
|
|
|
|
sleep_ms(3000);
|
|
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
|
// ds.convert();
|
|
|
|
|
// temp_act = ds.getTemperature();
|
|
|
|
|
temp_act = 23.5;
|
|
|
|
|
int duration = oneWire.convert_temperature(address, true, false);
|
|
|
|
|
temp_act = oneWire.temperature(address);
|
|
|
|
|
|
|
|
|
|
if (isSystemOn && temp_act < temp_tgt - temp_diff) {
|
|
|
|
|
isHeating = true;
|
|
|
|
@ -75,5 +78,8 @@ int main() {
|
|
|
|
|
|
|
|
|
|
myLCD.setCursor(0, 0);
|
|
|
|
|
myLCD.sendString(lcdText.str());
|
|
|
|
|
if (duration > 0 && duration <= 1000) {
|
|
|
|
|
sleep_ms(1000 - duration);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|