Need help on timer

Hello everyone,

I am new to Arduino and making a small project like Automatic Plant Watering. I have set up everything and it is working perfectly. I am really happy.

However, I am using this Sensor. It is really cheap. I know that it is going to die soon.

Is there any way that I can set up a fixed time for the sensor to be powered on and off? For example, the sensor will be powered on like 5 seconds and off for 10 seconds, then on 10 seconds and off 10 seconds (keeps continue like this).

I have set up another Arduino with the sensor only. This time I connect the Vcc to digital pin 8, A0 to A0, and GRD to ground, but the sensor keeps giving 0 value although it is on the air, and 92 when it is in the water. Isn't the sensor value supposed to be 1023 while it's on the air and 200 something in the water?

I don't know what is wrong with it. Please help. Thank you

This is the code

int power = 8; int power_on = 5000; int power_off = 10000;

void setup() { Serial.begin(9600); pinMode (power, OUTPUT); }

void loop() { int sensor1 = analogRead(A0); digitalWrite (power, HIGH); Serial.print("Moisture : "); Serial.println(sensor1); delay (power_on);

digitalWrite (power, LOW); delay (power_off);




Thank you for replying.

I set up for 10s on and 60s off, but the sensor is on for the first 10 seconds, then it's off completely.

What if I want the sensor to be on 10 seconds and off for 3 hrs, then on gain for 10 seconds, how can I do that?