Skip to content

zMuh/arduino_with_6_servos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Arduino with 6 servos

Connecting and using 6 servo motors on arduino

Tinkercad Link

Screenshots

App Screenshot

Code

#include <Servo.h>

int pos = 0;

const int nServos = 6;

Servo servos[nServos];

const int servoPin[nServos] = {8,9,10,11,12,13};

void setup()
{
  for(int i=0;i<nServos; i++){
  	servos[i].attach(servoPin[i]);
    servos[i].write(0);
  }
}

void loop() {
  for (int s=0; s<nServos; s++){
  for (pos = 0; pos <= 180; pos += 1) { 
    servos[s].write(pos);              
    delay(15);                      
  }
  for (pos = 180; pos >= 0; pos -= 1) { 
    servos[s].write(pos);              
    delay(15);                       
  }

  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages