update temp
This commit is contained in:
parent
ad36a04f40
commit
86035046d3
|
@ -1,2 +1,6 @@
|
||||||
|
#include <OneWire.h>
|
||||||
|
#include <DallasTemperature.h>
|
||||||
|
|
||||||
void temp_init();
|
void temp_init();
|
||||||
void temp_loop();
|
void temp_loop();
|
||||||
|
float getTemp();
|
|
@ -19,4 +19,6 @@ lib_deps =
|
||||||
teckel12/NewPing@^1.9.5
|
teckel12/NewPing@^1.9.5
|
||||||
gitlab-airbornemint/Protothreads@^1.4.0-arduino.beta.1
|
gitlab-airbornemint/Protothreads@^1.4.0-arduino.beta.1
|
||||||
adafruit/Adafruit MPU6050@^2.2.4
|
adafruit/Adafruit MPU6050@^2.2.4
|
||||||
|
paulstoffregen/OneWire@^2.3.7
|
||||||
|
milesburton/DallasTemperature@^3.11.0
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
|
20
src/temp.cpp
20
src/temp.cpp
|
@ -0,0 +1,20 @@
|
||||||
|
#include <DallasTemperature.h>
|
||||||
|
#include <OneWire.h>
|
||||||
|
#include <temp.h>
|
||||||
|
|
||||||
|
OneWire oneWire(D1);
|
||||||
|
DallasTemperature sensors(&oneWire);
|
||||||
|
|
||||||
|
void wd_init() {
|
||||||
|
sensors.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wd_loop() {
|
||||||
|
// ; // Send the command to get temperatures
|
||||||
|
// Serial.println(sensors.getTempCByIndex(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
float getTemp(){
|
||||||
|
sensors.requestTemperatures();
|
||||||
|
return sensors.getTempCByIndex(0);
|
||||||
|
}
|
Loading…
Reference in New Issue