From 52a456d6a36d48e09033a48d64c66673bb19c754 Mon Sep 17 00:00:00 2001 From: opekk Date: Thu, 21 May 2026 23:37:01 +0200 Subject: feat: add function to read all sensors --- src/main.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') 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 #include #include - +#include +#include /* 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(){ -- cgit v1.2.3