English above Netherland underneath.
I want to be able to read the water level on an LCD screen (1620A).
I've tried everything but don't know how to program it.
The idea is that if the water level is too low, a pump will start, but I also want to be able to read the water level on an LCD.
This is the sketch that I use and my question is whether you would like to finish it further. I am 14 and I am just starting out, so I don't have much experience.
sketch:
#include <LiquidCrystal.h>
const int waterSens = A0; // define water sensor
const int pump = 10; // define pump to pin 10
int waterVal; // define the water sensor value
const int rs = 12, and = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd (rs, and, d4, d5, d6, d7);
void setup () {
pinMode (waterSens, INPUT); // set of water sensor as an input
Serial.begin (9600); // start the serial port at 9600 bauds
pinMode (pump, OUTPUT); // set pump as an output
}
void loop () {
int SensorValue = analogRead (waterSens);
Serial.println ();
if (SensorValue> = 350)
{
digitalWrite (pump, LOW); // if the water sensor senses water turn the pump off
}
else
{
digitalWrite (pump, HIGH); // if it doesn't sense anything turn the pump on
delay (650);
digitalWrite (pump, LOW); // if it doesn't sense anything turn the pump off
delay (2500);
}
}
I just don't understand what I have to write for the LCD with void setup and void loop.
If you want to help me, thank you in advance.
Nederlands:
Ik wil het water niveau kunnen aflezen op een lcd scherm(1620A).
Ik heb van alles geprobeerd maar weet niet hoe ik het moet programmeren.
Het idee is dat als het water niveau te laag is een pomp aan gaat, alleen wil ik ook het water niveau kunnen aflezen op een lcd.
Dit is de sketch die ik gebruik en mijn vraag is of u het verder zou willen afmaken. Ik ben 14 en begin pas net, dus heb ik niet veel ervaring.
sketch:
#include <LiquidCrystal.h>
const int waterSens = A0; //define water sensor
const int pump = 10;//define pump to pin 10
int waterVal; //define the water sensor value
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
pinMode(waterSens, INPUT);//set water sensor as an input
Serial.begin(9600); //start the serial port at 9600 bauds
pinMode(pump, OUTPUT); //set pump as an output
}
void loop() {
int SensorValue = analogRead(waterSens);
Serial.println();
if (SensorValue >= 350)
{
digitalWrite(pump, LOW);//if the water sensor senses water turn the pump off
}
else
{
digitalWrite(pump, HIGH);//if it doesn't sense anything turn the pump on
delay (650);
digitalWrite(pump, LOW);//if it doesn't sense anything turn the pump off
delay (2500);
}
}
Ik snap alleen niet wat ik bij void setup en void loop moet schrijven voor de lcd.
Als u me wilt helpen alvast bedankt.