Well I have been fighting this all day and can't seem to get it. What I am trying to accomplish is to pass an integer from one function to another function and update a delay time Just one of the many I have. Problem is if I put in a for loop the code automatically starts. So I know I am doing something wrong. I know I could get it by adding if statements throughout the code but by golly do I ever have a lot of those.Problem with being a noob I guess.. S I want to pass a number from this function
void setDel (int Del)
{
if (Del ==1)
{
lcd.setCursor (5,0);
lcd.print ("1.15 Sec");
}
else if (Del ==2)
{
lcd.setCursor (5,0);
lcd.print ("1.25 Sec");
}
to this function
// determine if start button3 is high or low
int setState ()
{
int d;
if ((scrPer == 1) && (scrTime==1)&& digitalRead(BUTTON3)==HIGH)
{
digitalWrite (rel,HIGH);
delay (d); // <--- This is where I want to declare the new time
digitalWrite (rel,LOW);
analogWrite (sol,25);
delay (100);
analogWrite (sol,50);
delay (100);
analogWrite (sol,75);
delay (100);
analogWrite (sol,100);
delay (100);
analogWrite (sol,125);
delay (100);
analogWrite (sol,150);
delay (100);
analogWrite (sol,175);
delay (100);
analogWrite (sol,200);
delay (100);
analogWrite (sol,225);
delay (100);
analogWrite (sol,250);
delay (5000);
analogWrite (sol,LOW);
}
these are just one of many if statements.... this code compiles.... I read someones tag and it said to look at what you last did for the error.so the attached code is the last point that the program worked the way I wanted it.... advice? should I be fighting with a loop or sticking with if else? Thanks for your time
today.ino (69.7 KB)