Need help replacing delays with millis

int analogInput = A0;
unsigned int total;
float voltage;
float vout = 0.0;
float R1 = 1000;
float R2 = 1000;
int value = 0;
float batt1;
float batt2;
float batt_LOW = 1.40;
float batt_MAX = 4.40;
int Start = 2;
int GREEN_LED = 3;
int charge_1 = 4;
int charge_2 = 5;
int charge_3 = 6;
int charge_4 = 7;
int charge_5 = 8;

void setup()
{ Serial.begin(9600);
pinMode(GREEN_LED, OUTPUT);
pinMode(analogInput, INPUT);
pinMode(charge_1, OUTPUT);
pinMode(charge_2, OUTPUT);
pinMode(charge_3, OUTPUT);
pinMode(charge_4, OUTPUT);
pinMode(charge_5, OUTPUT);
pinMode(Start, INPUT_PULLUP);
digitalWrite(charge_1, HIGH);
digitalWrite(charge_2, HIGH);
digitalWrite(charge_3, HIGH);
digitalWrite(charge_4, HIGH);
digitalWrite(charge_5, HIGH);
delay(500);
}

void loop()
{
if (digitalRead(Start) == LOW)
{ Serial.println(" NOW ON. ");
delay(800);
digitalWrite(GREEN_LED, LOW);
batt_1();
}
}

void batt_1()
{ total = analogRead(analogInput);
batt1 = (total);
delay(1000);
total = 0;

if (batt1 >= batt_MAX)
{ digitalWrite(charge_1, LOW);
delay(60000);
digitalWrite(charge_2, LOW);
delay(120000);
digitalWrite(charge_3, LOW);
delay(60000);
digitalWrite(charge_4, LOW);
delay(80000);
digitalWrite(charge_5, HIGH);
delay(120000);
batt_2();
}
}

void batt_2()
{ total = analogRead(analogInput);
batt2 = (total); // convert readings to volt
delay(1000); // 2 seconds between measurements
total = 0; // reset value

if (batt2 <= batt_LOW)
{ delay(1000);
digitalWrite(charge_1, HIGH);
delay(1000);
digitalWrite(charge_2, HIGH);
delay(1000);
digitalWrite(charge_3, HIGH);
delay(1000);
digitalWrite(charge_4, HIGH);
delay(1000);
digitalWrite(charge_5, LOW);
delay(180000);
batt_Stop();
}
}

void batt_Stop()
{ delay(1000);
digitalWrite(charge_1, HIGH);
digitalWrite(charge_2, HIGH);
digitalWrite(charge_3, HIGH);
digitalWrite(charge_4, HIGH);
digitalWrite(charge_5, HIGH);
delay(1000);
}

that's at the start of your code, may be it's a hint.

Why didm't you follow the advice that you yourself posted ?

Why
does
your
code
wander
all
over
the
page?

no idea. im new posting

Whilst the compiler does not care about blank lines and empty space in code it makes it difficult for humans to read

Please use Auto Format in the IDE then post the code here in < CODE/ > tags in a new post in this topic

sorry im a newby.

can anyone help me with this riddler....

i been trying to replace delay with millis without success

no matter how i tried millis won't work.

Please show how you tried

i erase already

Unfortunately you cannot simply replace delay() with millis(). Instead you have to use a completely different structure for your sketch such that instead of blocking its operation using delay() you use millis() to determine whether it is time to do something and if not, go and do something else

See Using millis() for timing. A beginners guide, Several things at the same time and the BlinkWithoutDelay example in the IDE

thats the last code a have to work with

thanks for your help

can anyone help me replacing this delay with millis or point me in the right direction .
in bein having a hard time with this school project.

Hello

In general - Arrays and structs are your friends.
Don't duplicate code in your sketch. Write code once - use it multiple times.

Use the BlinkWithOutDelay example of the IDE to design and code your own timer() functions as needed for your project.

Have a nice day and enjoy coding in C++.

already done - see post #11


thanks to all of you for a nice welcome....good day to all.

What does this arrow means?

I suppose this is to show that he fixed the code tags in post 1

O-ps
understand