Hi everyone, first of all sorry for my bad english but i’m italian and i’m learning it and Blynk
I’m trying to create a simple project wich is an automated plant with arduino. I’m using 2 sensors, a moisture for the soil that controls a little pump and a water sensor that sends me a notification when the water level is too low. The problem is that the notification just keep going on and on on my Android and i want just a notification every 10 minutes or so. I’m not an expert so i hope you can give me some advices to code arduino and Blynk. Thank you so much!
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); // Dichiara Pin Display LCD
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "my token";
#define W5100_CS 10
#define SDCARD_CS 4
int livelloacqua = 0;
int umiditaterra = 0;
#define LEDV1 9
#define LEDV2 10
#define LEDR1 11
#define LEDR2 12
void setup() {
// Debug console
Serial.begin(9600);
pinMode(SDCARD_CS, OUTPUT);
digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
Blynk.begin(auth);
// You can also specify server:
//Blynk.begin(auth, "blynk-cloud.com", 80);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8080);
// For more options, see Boards_Ethernet/Arduino_Ethernet_Manual example
lcd.begin(16, 2);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
lcd.clear();
}
void loop() {
Blynk.run();
lcd.setCursor(0, 0);
livelloacqua = analogRead(A0);
if (livelloacqua < 160) {
lcd.setCursor(0, 0);
lcd.print("Riempire acqua ");
Blynk.notify("L'acqua è in esaurimento! Devi riempirla!");
}
if (livelloacqua >= 130) {
lcd.setCursor(0, 0);
lcd.print("Acqua OK ");
}
umiditaterra = analogRead(A1);
if (umiditaterra > 500) {
lcd.setCursor(0, 1);
lcd.print("Annaffiare ");
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
digitalWrite(12, HIGH);
}
if (umiditaterra < 500) {
lcd.setCursor(0, 1);
lcd.print("Pianta OKAY ");
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
digitalWrite(12, LOW);
}
}