hi i made a program that the servo sweeps and when it dedect a high temp the servo stops but it wont stop.
im new at programming.
this is a piece of the code. // IF ELSE if (Temp3 < 30) { // If the temp is too low it sweeps digitalWrite(ledPin, LOW); // sets the LED off servo_sweep(); }else{ // If the temp is too high the led turns on digitalWrite(ledPin, HIGH); // sets the LED on } //END OF IF STATEMENT delay(100); } void servo_sweep(){ for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees { // in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees { myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } }
Your servo sweep takes nearly five and half seconds - how rapidly does the temperature change?
Please post ALL your code,and use the # icon on the editor's toolbar.