I apologize but my lack of knowledge in this area is making it very hard to search and find the answer I need...and when i think i find an answer, I try to edit my code with what I do find and it will not compile.
In brief, my boiler will not fire when called upon by the thermostat. I need to manually lift a small plunger to have the boiler fire. I connected a wire to the plunger which runs to a servo that I have programmed to go from 0 to 180 degrees. When it turns, it pulls the wire over a pulley and the plunger raises resulting in the boiler firing. In order to control the board, I have the power supply plugged into a timer to cut on before I wake. Below is the code as I could piece together from multiple posts. When the board receives power, the program runs, pulling my wire along as the servo moves from 0 to 180 degrees. I have a delay of 45 minutes for the boiler to reach temperature before the servo returns from 180 to 0 effectively lowering the plunger back to its starting position. This is where I would like the program to end so that the timer can cut the board power and restart the cycle when the timer switches power back to the board.... I tried putting everything into the setup command but could not get it to compile, i tried an infinite loop at the end and couldn't get it to compile. I tried a void shutdown command...so I'm at a loss. Here is what i have, any help would be much appreciated. There may be a better way altogether. Also...Is there a limit to the delay I can put in, say if i wanted it longer than 45 minutes?
I also ordered a thermostat switch that could power on the board but i'm not sure that will help because the servo would not return to zero when the power was cut. At least it would automatically cut on via the thermostat and cut itself off via the end of the program.
Here is the code i have so far:
//code must include Servo.h library in order to work
#include <Servo.h>
Servo myservo;
//creates servo object to control a servo
int angle=0;
void setup()
{
myservo.attach(9); //attaches the servo on pin 9 to the servo object
}
void loop()
{
for (angle=0; angle<180; angle+=1)
//goes from 0 to 180 degrees in steps of 1 degree
{
myservo.write(angle); //directs servo to go to position in variable 'angle'
delay(20);//waits 20ms between servo commands
}
delay(2700000);
for (angle=180; angle>=1; angle-=1) //goes from 180 to 0 degrees
{
myservo.write(angle); //moves servo back in opposite direction
delay(20); //waits 20ms between servo commands
}
}
Thank you very much for your time and any advice you may be able to provide.