Timer for 75 seconds?
hello guys, trying move servo once every 75 seconds. reason unable this, instead of waiting 75 seconds, servo waits 11 seconds( timed it) , moves. there limit value in "delay"? in code put delay 75000, should equal 75 seconds. used 75000 variable, because didn't feel manually changing delay value every time wanted different value. admit i've never made timer long before, doing wrong? need different if it's above minute delay?
what doing wrong here? appreciated.
what doing wrong here? appreciated.
code: [select]
#include <servo.h>
servo servo_0; //define servo
int x = 75000;
void setup()
{
servo_0.attach(0); // attaches servo on pin 0 servo object
servo_0.write(90); // starting position
delay(1000);
}
void loop()
{
//individual servo control
servo_0.write(0); //first movement 0 degrees
delay(x);
servo_0.write(15); //first movement 15 degrees
delay(x);
servo_0.write(30); //second movement 30 degrees
delay(x);
servo_0.write(45); //third movement 45 degrees
delay(x);
servo_0.write(60); //first movement 60 degrees
delay(x);
servo_0.write(75); //second movement 75 degrees
delay(x);
servo_0.write(90); //third movement 90 degrees
delay(x);
servo_0.write(105); //first movement 105 degrees
delay(x);
servo_0.write(120); //second movement 120 degrees
delay(x);
servo_0.write(135); //third movement 135 degrees
delay(x);
servo_0.write(150); //first movement 150 degrees
delay(x);
servo_0.write(165); //second movement 165 degrees
delay(x);
servo_0.write(180); //third movement 180 degrees
delay(x);
servo_0.write(165); //first movement 165 degrees
delay(x);
servo_0.write(150); //second movement 150 degrees
delay(x);
servo_0.write(135); //third movement 135 degrees
delay(x);
servo_0.write(120); //first movement 120 degrees
delay(x);
servo_0.write(105); //second movement 105 degrees
delay(x);
servo_0.write(90); //third movement 90 degrees
delay(x);
servo_0.write(75); //first movement 75 degrees
delay(x);
servo_0.write(60); //second movement 60 degrees
delay(x);
servo_0.write(45); //third movement 45 degrees
delay(x);
servo_0.write(30); //first movement 30 degrees
delay(x);
servo_0.write(15); //second movement 15 degrees
delay(x);
servo_0.write(0); //second movement 0 degrees
delay(x);
}
75000 stored int resulting in 11 seconds, sounds right (its 9.465 seconds or 9 int).
quote
int x = 75000;perhaps should @ arduino reference page int and see range is.
Arduino Forum > Using Arduino > Programming Questions > Timer for 75 seconds?
arduino
Comments
Post a Comment