hey i was trying to turn on and off the led when a variable reach a certain threshold value and stay in that condition until it reaches another threshold value
for example i have a variable x whose value vary between 1 and 10.when the value of x become 1 i want to turn the led on and stay on until it reaches 10 and when it reaches 10 it should stay off until it again reaches 1.
may be something like that :/
if(x==10){
digitalWrite(led,HIGH);
}
else if(x==1){
digitalWrite(led,LOW);
}
else {
// some code that keeps the led state in which it was unitil it reaches the other thershold value
}
for example i have a variable x whose value vary between 1 and 10.when the value of x become 1 i want to turn the led on and stay on until it reaches 10 and when it reaches 10 it should stay off until it again reaches 1.
may be something like that :/
if(x==10){
digitalWrite(led,HIGH);
}
else if(x==1){
digitalWrite(led,LOW);
}
else {
// some code that keeps the led state in which it was unitil it reaches the other thershold value
}