• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
AHT10
#1
Witam potrzebuje pomocy mam juz większość kodu ale nie mogę w żaden sposób poradzić sobie z AHT10 potrzebuje żeby wyświetlał sie w blynk Gauge z temperatura i wilgotnością. Thinary_AHT10.h wyświetla tylko przez serial dobre odczyty bo juz na blynk jakies kosmiczne numery :/ jak ktos mogl by byc taki dobry i dopisac do kodu ten AHT10 wdzieczny nie do opisania bym byl Big Grin

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>

#define D5 14
#define D1 04
#define D2 05


char auth[] = "6";
char ssid[] = "VM6669770";
char pass[] = "";
const int AirValue = 1024;  
const int WaterValue = 550;  
int soilMoistureValue = 0;
int soilmoisturepercent=0;
SimpleTimer timer;

void MainFunction() {
  soilMoistureValue = analogRead(A0); 
  Serial.println(soilMoistureValue);
  soilmoisturepercent = map(soilMoistureValue, AirValue, WaterValue, 0, 100);
  if(soilmoisturepercent < 10) 
  {
  Serial.println("Nearly dry, Pump turning on");
  digitalWrite(D5,HIGH); // Low percent high signal to relay to turn on pump
  }
  else if(soilmoisturepercent >85)
  {
  Serial.println("Nearly wet, Pump turning off");
  digitalWrite(D5,LOW); 
  }
  Blynk.virtualWrite(V2, soilmoisturepercent); 
  }


void setup() {
  pinMode(D5,OUTPUT);
  Serial.begin(9600); 
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L,MainFunction);
 
}
void loop() {
  Blynk.run();
  timer.run();
}
 
Odpowiedź
  


Skocz do:


Przeglądający: 1 gości