This is for a design project. I need to program my robot to drive forward 10 feet, drop a wooden block, and drive forward 10 more feet.
What I need help with:
The robot uses one motor (actually a continuous rotation servo) and one servo. The motor drives the robot forward in a straight line. The servo controls the dropping of the block. Basically there is a bent shaft that the block rests on that will rotate up and out of the way to drop the block.
So I know that the robot takes 12.5 seconds to reach 10 feet. My idea was to program the robot to just keep driving until switched off, and to turn the servo on after the system has been turned on for 12.5 seconds. Sounds like it would be simple enough to program… I tried using an If statement:
myservo is the motor for the drive system. myotherservo is the servo for the release mechanism.
int time = millis();
if(time > 12500)
When I use this code, the motor (myservo) runs continuously as it should, but the servo (myotherservo) just runs immediately as the system is switched on. After 12.5 seconds, it runs again. I have tried the idea of this code in different ways, but no matter what I do, it behaves the same way.
I am new to programming with an Arduino (and programming in general) so I am having a lot of trouble finding out what I’m doing wrong. If anyone could help lead me in the right direction it would greatly appreciated. I need this thing running perfectly by Tuesday.
Thanks in advance for your help.