summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index ef8a702..ca4efb7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -7,7 +7,8 @@
#include <SPI.h>
#include <ESP32Servo.h>
#include <ezButton.h>
-
+#include <OneWire.h>
+#include <DallasTemperature.h>
/* todo
* pobierac temp z onewire (wybierz jakes piny) i aktualizowac w loopie co np 10 sekund.
@@ -28,6 +29,12 @@
Adafruit_ST7789 tft = Adafruit_ST7789(&SPI, TFT_CS, TFT_DC, TFT_RST);
Servo myServo;
+OneWire oneWire(ONE_WIRE_BUS);
+DallasTemperature sensors(&oneWire);
+
+
+float tempInternal;
+float tempCurrent;
float temp_min_internal;
float temp_max_external;
@@ -35,6 +42,24 @@ float temp_max_external;
float temp_cur_internal;
float temp_cur_external;
+int deviceCount = 0;
+
+void setupSensors(){
+ sensors.begin(115200); // baud rate
+
+ Serial.print("Searching for devices.")
+ deviceCount = sensors.getDeviceCount();
+
+ if(deviceCount != 0) {
+ Serial.print(deviceCount, DEC);
+ }
+
+ else {
+ Serial.print("Cannot find any devices connected to One_Wire_Bus");
+ }
+
+}
+
void setupDisplay(){