SEN0161 pH sensor controller help

Good day.

I am developing a pH controller that pumps pH Up or pH down nutrient according to the measured level of pH in a tank.

I have a pH sensor (SEN0161 DFROBOT) which is an analog input for my system that produces pH values upon placement in different liquids.
I would like my pumps to only go on after 10-15 readings from the pH sensor have been produced.

My current code is as follows:

       if (pHValue <5)
        {
          digitalWrite(pHUp,LOW);
          delay(30);
          digitalWrite(pHUp,HIGH);
        }
        if(pHValue>8.5)
        {
          digitalWrite(pHDown,LOW);
          delay(30);  
          digitalWrite(pHDown,HIGH);
        }
        if(pHValue>=5 || pHValue<=8.5)
        {
          digitalWrite(pHUp,HIGH);
          digitalWrite(pHDown,HIGH); 
        }

How do I do this?

Regards,
Darshal

Use a counter... increase upon every reading.

Hi there.

What is a counter? How do I use a counter?

Regards,

Just a variable that you increase one at a time.

Thank you.

In terms of using a 'for' loop or using millis() as a timer, what is the difference?