2024-10-1500
This commit is contained in:
parent
62fbc84e5a
commit
15857f1686
|
@ -12,7 +12,6 @@
|
|||
platform = espressif32
|
||||
board = upesy_wroom
|
||||
framework = arduino
|
||||
monitor_port = /dev/ttyUSB0
|
||||
monitor_speed = 115200
|
||||
monitor_filters = time
|
||||
lib_deps =
|
||||
|
|
21
src/main.cpp
21
src/main.cpp
|
@ -41,17 +41,6 @@ int d = 0;
|
|||
void analogMeter();
|
||||
void plotNeedle(int value, byte ms_delay);
|
||||
|
||||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
|
||||
// Data wire is plugged into port 2 on the Arduino
|
||||
#define ONE_WIRE_BUS 22
|
||||
|
||||
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
|
||||
OneWire oneWire(ONE_WIRE_BUS);
|
||||
|
||||
// Pass our oneWire reference to Dallas Temperature.
|
||||
DallasTemperature sensors(&oneWire);
|
||||
|
||||
void setup(void) {
|
||||
tft.init();
|
||||
|
@ -62,11 +51,9 @@ void setup(void) {
|
|||
//I2C_2.begin(SDA_2, SCL_2, I2C_FREQ);
|
||||
//delay(9000);
|
||||
|
||||
sensors.requestTemperatures(); // Send the command to get temperatures
|
||||
Serial.println("DONE");
|
||||
|
||||
|
||||
Serial.print("Temperature for the device 1 (index 0) is: ");
|
||||
Serial.println(sensors.getTempCByIndex(0));
|
||||
|
||||
|
||||
//delay(10000);
|
||||
|
||||
|
@ -88,8 +75,8 @@ void loop() {
|
|||
// Create a Sine wave for testing
|
||||
d += 4; if (d >= 360) d = 0;
|
||||
value[0] = 50 + 50 * sin((d + 0) * 0.0174532925);
|
||||
sensors.requestTemperatures(); // Send the command to get temperatures
|
||||
Temperatur = sensors.getTempCByIndex(0);
|
||||
|
||||
|
||||
plotNeedle(value[0], 0); // It takes between 2 and 12ms to replot the needle with zero delay
|
||||
tft.fillRect(0, 179, 310, 60, TFT_GREEN);
|
||||
tft.setTextColor(TFT_BLACK,TFT_GREEN);
|
||||
|
|
Loading…
Reference in New Issue
Block a user