if (language == english){
scrollDown;
}
Hallo zusammen,
ich bin noch recht neu in Sachen Blynk. Ich habe das Prinzip ungefähr verstanden aber komme hier nicht mehr weiter:
Projekt Gartenbewässerung
Ich habe in Blynk zwei Knöpfe, einer für manuelles bewässern und einer für den Automatikmodus.
Im Automatikmodus soll selbständig geschaltet werden wenn der Wert ´Feuchte<=400´ist.
Wenn der Wert darunter ist, schaltet die Pumpe einmalig ein und dann nicht mehr.
Wenn der Wert darüber ist und unter 400 fällt, passiert nichts.
Kann mir jemand behilflich sein?
Vielen Dank
Code
First of all I would like to say that my english is not the best and I partly used a translator.
Project Garden Irrigation
I have two buttons in Blynk, one for manual watering and one for the automatic mode.
In the automatic mode I want to switch automatically if the value is ‘Humidity<=400’.
If the value is below that, the pump will switch on once and then not anymore.
If the value is above and falls below 400, nothing happens.
Can anyone help me?
Thanks a lot
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Blynk.h>
#define pumpe 5
#define sensorPin A0
char auth[] = "TOKEN";
char ssid[] = "WLAN";
char pass[] = "CODE";
int Feuchte = 46;
int sensorWert = 400;
WidgetLED led3(V3);
WidgetLED led4(V4);
BLYNK_WRITE(V1){
int autoBTN = param.asInt();
Serial.print(autoBTN);
if(autoBTN==1){
led4.on();
led3.off();
Automatikbetrieb();
}
if(autoBTN==0){
led3.on();
led4.off();
}
}
BLYNK_WRITE(V0){
int manualBTN = param.asInt();
Serial.print(manualBTN);
if(manualBTN==1){
led4.on();
led3.off();
Pumpenstart();
}
if(manualBTN==0){
led3.on();
led4.off();
}
}
void setup() {
// put your setup code here, to run once:
pinMode(A0, INPUT);
pinMode(5, OUTPUT);
pinMode(V2, OUTPUT);
pinMode(V1, INPUT);
WidgetLED led3(V3);
//pinMode(V3, Feuchte);
Serial.begin(9600);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected..!");
Blynk.begin(auth, ssid, pass);
}
void loop() {
Blynk.run();
WidgetLED led3(V3);
WidgetLED led4(V4);
}
/*
* ------Funktionsbau unterhalb--------
*
*/
void Automatikbetrieb(){
sensorWert = analogRead(sensorPin);
//sensorWert = sensorPin;
Feuchte = map(sensorWert, 640, 220, 0, 100);
if (sensorWert <= 500){
digitalWrite(5, HIGH);
delay(5000);
digitalWrite(5, LOW);
}
if (sensorWert > 550){
digitalWrite(5, LOW);
}
}
void Sensorlesen(){
analogRead(sensorWert);
Serial.println(sensorWert);
Feuchte = map(sensorWert, 640, 220, 0, 100);
Serial.println(Feuchte);
}
void Pumpenstart(){
digitalWrite(5, HIGH);
delay(10000);
digitalWrite(5, LOW);
}