#include <OneWire.h>
#include <DallasTemperature.h>
// GPIO where the DS18B20 is connected to
const int oneWireBus = 6;
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(oneWireBus);
// Pass our oneWire reference to Dallas Temperature sensor
DallasTemperature sensors(&oneWire);
const int RELAY_PIN = 4; // the Arduino pin, which connects to the IN pin of relay
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin as an output.
pinMode(RELAY_PIN, OUTPUT);
sensors.begin();
}
// the loop function runs over and over again forever
void loop() {
Serial.println("Start");
//sensors.requestTemperatures();
//float temperatureC = sensors.getTempCByIndex(0);
//float temperatureF = sensors.getTempFByIndex(0);
//Serial.print(temperatureC);
//Serial.println("ºC");
//Serial.print(temperatureF);
//Serial.println("ºF");
digitalWrite(RELAY_PIN, HIGH);
delay(500);
digitalWrite(RELAY_PIN, LOW);
delay(500);
}
Loading
esp32-s2-devkitm-1
esp32-s2-devkitm-1