Hello
Its been a while since i've played with Arduino
Im making a digger move on my model railway using 4 servos.
what i would like to do is run the code while im testing how far to move the servos..
say i wanted to run this code once out side the loop how do i do it?
for(pos = 80; pos < 100; pos += 1){ // down
up.write(pos);
delay(10);
}
This is my code:
// This is for a model digger in Ho scale for a model railway
// Jason fletcher = 11.01.2014#include <Servo.h>
Servo diggerturn ;
Servo dig ;
Servo up ;
Servo down ;int pos = 0;
void setup(){
diggerturn.attach(8);
up.attach(9);
down.attach(10);
dig.attach(11);
}void loop()
{ // Open //for(pos = 140; pos>= 20; pos-= 1){ // Empty the bucket release the tention
dig.write(pos);
delay(10);
}for(pos = 120; pos>= 80; pos -= 1){ // Release the tention on the the down
down.write(pos);
delay(10);
}for(pos = 120; pos>= 50; pos-= 1){ //up
up.write(pos);
delay(550);
}// low number = police man, high number = pit
for(pos = 65; pos < 110; pos += 1) // Turn towards the pit
{
diggerturn.write(pos);
delay(100); // Speed it turns
}delay(1000);
for(pos = 110; pos>= 65; pos-=1) // Turn away from the pit
{
diggerturn.write(pos);
delay(100); // Speed it turns
}for(pos = 80; pos < 100; pos += 1){ // down
up.write(pos);
delay(10);
}} /// END //.............................
Many thanks Jason