0
καλήμερα θέλω να κάνω το σερβομοτερ να λειτουργεί όποτε θέλω εγώ με εντολή και στην εντολή for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
delay(15); θέλω να δουλεύει για ένα λεπτό και μετά να πηγαίνει στη θέση for(pos = 0; pos < 400; pos += 1) // goes from 0 degrees to 180 degrees
delay(15); τη βοήθεια σας ευχαριστώ
ο κωδικός που έχω είναι
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(2); // attaches the servo on pin 9 to the servo object
}
void loop()
{
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 = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
delay(15); // waits 15ms for the servo to reach the position
}
}