Given below is my loop and it counts 1 to 250 using the push button i just added this part as this one is the main part. I want to make it in steps like one press (push button) SETS IT TO 10 OR 20 ETC. Many thanks in advance for your kindness.
if ((digitalRead(2)==HIGH) && (digitalRead(7)==LOW))
{
if (j<255)
{j++;
lcd.setCursor(5,1);
lcd.print(" ");
lcd.setCursor(5,1);
lcd.print(j);
while((digitalRead(2)==HIGH) && (digitalRead(7)==LOW));}
}
else if ((digitalRead(2)==LOW) && (digitalRead(7)==HIGH))
{
if (j>0)
{j--;
lcd.setCursor(5,1);
lcd.print(" ");
lcd.setCursor(5,1);
lcd.print(j);
while((digitalRead(2)==LOW) && (digitalRead(7)==HIGH));}
}
analogWrite(9,j);
//lcd.noDisplay();
lcd.display();
delay(100);
}
i have a problem... there is nothing said about a problem in your post ... what happens when you run the program?jdefined? What do you see on the LCD?jin bigger steps, just replacej++andj--by for examplej+=10andj-=10. Though I suspect that thats not all of the problem