ani body wat do i wrong
const int mSensor = 2;
const int mPump = LED_BUILTIN ;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(mSensor, INPUT); //setpin#2 as input
pinMode(mPump, OUTPUT); //setpin#13 as output
}
void loop() {
// put your main code here, to run repeatedly:
int mState = digitalRead (mSensor); //read the value of sensor
Serial.println (mState);
delay (10);
if (mState == HIGH) { //if the moisure sensor is dry equal to logic 1 or high
digitalWrite(mPump, HIGH); //the water pump will relase water
delay (10);
}
else {
digitalWrite(mPump), LOW); //if the moisure sensor is wet equal to logic 0 or low
delay(10); //the water pump will stop releasing water
)
}
If you would put code tags (</>), you sketch would appear like below and the task of finding errors would be easier.
const int mSensor = 2;
const int mPump = LED_BUILTIN ;
void setup()
{
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(mSensor, INPUT); //setpin#2 as input
pinMode(mPump, OUTPUT); //setpin#13 as output
}
void loop()
{
// put your main code here, to run repeatedly:
int mState = digitalRead (mSensor); //read the value of sensor
Serial.println (mState);
delay (10);
if (mState == HIGH)
{ //if the moisure sensor is dry equal to logic 1 or high
digitalWrite(mPump, HIGH); //the water pump will relase water
delay (10);
}
else
{
digitalWrite(mPump), LOW); //if the moisure sensor is wet equal to logic 0 or low
delay(10); //the water pump will stop releasing water
)
}
You posted in the wrong section, one that was NOT for your own project. I have moved it here.
Please take time to read the "getting the best out of this forum " sticky post at the start of each section.
const int mSensor = 2;
const int mPump = LED_BUILTIN ;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(mSensor, INPUT); //setpin#2 as input
pinMode(mPump, OUTPUT); //setpin#13 as output
}
void loop() {
// put your main code here, to run repeatedly:
int mState = digitalRead (mSensor); //read the value of sensor
Serial.println (mState);
delay (10);
if (mState == HIGH) { //if the moisure sensor is dry equal to logic 1 or high
digitalWrite(mPump, HIGH); //the water pump will relase water
delay (10);
}
else {
digitalWrite(mPump), LOW); //if the moisure sensor is wet equal to logic 0 or low
delay(10); //the water pump will stop releasing water
) <<-------------------------------------------------------------------this needs to be }
}