Arduino code 👇 #include Servo myservo; // create servo object to control a servo int pos = 0; // variable to store the servo position int led1 = 2; // first LED connected to digital pin 2 int led2 = 3; // second LED connected to digital pin 3 void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object pinMode(led1, OUTPUT); // sets the first LED as output pinMode(led2, OUTPUT); // sets the second LED as output } void loop() { // move the servo back and forth for (pos = 0; pos = 0; pos -= 1) { myservo.write(pos); // tell servo to go to position in variable 'pos' digitalWrite(led1, LOW); // turn off first LED digitalWrite(led2, HIGH); // turn on second LED delay(15); // waits 15ms for the servo to reach the position } }
@_Vikash_vlogs Жыл бұрын
Maa bap ka liya kitana subscribe brrata ha cholo dek ta ha