summaryrefslogtreecommitdiff
path: root/esp/src
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-10-28 21:08:06 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-10-28 21:08:06 -0300
commit0c5b080efac82b1d196e3dde00e5950c97ecbb68 (patch)
tree9cab7ac15860270014c45f76c661d50e5be689f2 /esp/src
parent7ccab61c22fafb3bb9fa5470ff8cb46217111fe4 (diff)
feat:leitura assíncrona de leitores
Diffstat (limited to 'esp/src')
-rw-r--r--esp/src/as5600.cpp13
-rw-r--r--esp/src/bh1750.cpp13
-rw-r--r--esp/src/bmp280.cpp20
-rw-r--r--esp/src/dht11.cpp18
-rw-r--r--esp/src/estacao_principal.ino39
-rw-r--r--esp/src/lm393.cpp26
6 files changed, 0 insertions, 129 deletions
diff --git a/esp/src/as5600.cpp b/esp/src/as5600.cpp
deleted file mode 100644
index 1dfdb71..0000000
--- a/esp/src/as5600.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <Wire.h>
-#include <AS5600.h>
-#include "as5600.h"
-
-AS5600 as5600;
-
-void setupAS5600() {
- as5600.begin(21, 22);
-}
-
-float lerAS5600() {
- return as5600.readAngle();
-}
diff --git a/esp/src/bh1750.cpp b/esp/src/bh1750.cpp
deleted file mode 100644
index 196705c..0000000
--- a/esp/src/bh1750.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <Wire.h>
-#include <BH1750.h>
-#include "bh1750.h"
-
-BH1750 lightMeter;
-
-void setupBH1750() {
- lightMeter.begin();
-}
-
-float lerBH1750() {
- return lightMeter.readLightLevel();
-}
diff --git a/esp/src/bmp280.cpp b/esp/src/bmp280.cpp
deleted file mode 100644
index 0ba749a..0000000
--- a/esp/src/bmp280.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <Wire.h>
-#include <Adafruit_BMP280.h>
-#include "bmp280.h"
-
-Adafruit_BMP280 bmp;
-
-void setupBMP280() {
- if (!bmp.begin(0x76)) {
- Serial.println("BMP280 nao achado");
- while (1);
- }
-}
-
-float lerTemperaturaBMP280() {
- return bmp.readTemperature();
-}
-
-float lerPressaoBMP280() {
- return bmp.readPressure() / 100.0F;
-}
diff --git a/esp/src/dht11.cpp b/esp/src/dht11.cpp
deleted file mode 100644
index 9900363..0000000
--- a/esp/src/dht11.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "DHT.h"
-#include "dht11.h"
-
-#define DHTPIN 32
-#define DHTTYPE DHT11
-DHT dht(DHTPIN, DHTTYPE);
-
-void setupDHT11() {
- dht.begin();
-}
-
-float lerTemperaturaDHT11() {
- return dht.readTemperature();
-}
-
-float lerUmidadeDHT11() {
- return dht.readHumidity();
-}
diff --git a/esp/src/estacao_principal.ino b/esp/src/estacao_principal.ino
deleted file mode 100644
index 65f155c..0000000
--- a/esp/src/estacao_principal.ino
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <Wire.h>
-#include "dht11.h"
-#include "bh1750.h"
-#include "bmp280.h"
-#include "lm393.h"
-#include "as5600.h"
-
-void setup() {
- Serial.begin(115200);
- Wire.begin(21, 22); // SDA, SCL
-
- setupDHT11();
- setupBH1750();
- setupBMP280();
- setupLM393();
- setupAS5600();
-
- Serial.println("Estacao iniciada");
-}
-
-void loop() {
- float tempDHT = lerTemperaturaDHT11();
- float umid = lerUmidadeDHT11();
- float lux = lerBH1750();
- float tempBMP = lerTemperaturaBMP280();
- float press = lerPressaoBMP280();
- int pulsos = lerLM393();
- float angulo = lerAS5600();
-
- Serial.println("----");
- Serial.print("Umid: "); Serial.print(umid); Serial.println(" %");
- Serial.print("Temp DHT: "); Serial.print(tempDHT); Serial.println(" C");
- Serial.print("Temp BMP: "); Serial.print(tempBMP); Serial.println(" C");
- Serial.print("Pressao: "); Serial.print(press); Serial.println(" hPa");
- Serial.print("Lux: "); Serial.print(lux); Serial.println(" lx");
- Serial.print("Pulsos: "); Serial.println(pulsos);
- Serial.print("Angulo: "); Serial.println(angulo);
- delay(30000);
-}
diff --git a/esp/src/lm393.cpp b/esp/src/lm393.cpp
deleted file mode 100644
index 5eb4bdf..0000000
--- a/esp/src/lm393.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <Arduino.h>
-#include "lm393.h"
-
-#define SENSOR_PIN 32 // ou 35 se preferir
-
-void setupLM393() {
- pinMode(SENSOR_PIN, INPUT);
-}
-
-int lerLM393() {
- static int contagem = 0;
- static unsigned long lastTime = 0;
-
- if (digitalRead(SENSOR_PIN) == LOW) {
- contagem++;
- delay(10);
- }
-
- if (millis() - lastTime >= 1000) {
- int pulsos = contagem;
- contagem = 0;
- lastTime = millis();
- return pulsos;
- }
- return 0;
-}