#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <DHT.h>
#include <SPI.h>
#include <Wire.h>
#include "Font7Seg.h"
#include <OneWire.h>
#include <DallasTemperature.h>
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 4 // Define the number of displays connected
#define CLK_PIN 16 // CLK or SCK
#define DATA_PIN 13 // DATA or MOSI
#define CS_PIN 12 // CS or SS
#define SPEED_TIME 75 // Speed of the transition
#define PAUSE_TIME 10
#define MAX_MESG 20
// Data wire is conntec to the Arduino digital pin 4
#define ONE_WIRE_BUS 4
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
int PowerPin = 17;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(PowerPin, OUTPUT);
digitalWrite(PowerPin, HIGH);
// Start up the library
sensors.begin();
Serial.println("Hello, ESP32!");
}
void loop() {
// put your main code here, to run repeatedly:
// Call sensors.requestTemperatures() to issue a global temperature and Requests to all devices on the bus
sensors.requestTemperatures();
Serial.print("Celsius temperature: ");
// Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire
Serial.print(sensors.getTempCByIndex(0));
delay(2000);
// this speeds up the simulation
}
Loading
ds18b20
ds18b20