How to run a servo test on arduino pro mini?

Hello, I’m a beginner with arduino and I’d like to know how to connect my servo with arduino pro mini. Also, want to run a simple test program with the servo.

I have this (see picture) but it doesn’t work :cold_sweat: I’ve connected the ground,signal and power…
and if I run the code I got exit status 1. Did I do something wrong with the wiring or is it the code? If you have other codes for me, you are welcome to share with me!

/* Sweep
 by BARRAGAN <http://barraganstudio.com>
 This example code is in the public domain.

 modified 8 Nov 2013
 by Scott Fitzgerald
 http://www.arduino.cc/en/Tutorial/Sweep
*/

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    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 = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

test.txt (9.61 KB)

I have this (see picture)

A schematic would be far more useful. There are three wires coming off the servo. Is it not clear where the orange wire goes. It is not clear exactly where the red and black wires go. It is not clear how the Arduino is being powered.

But, it appears that whatever is powering the Arduino is also expected to power the servo, which may not be a realistic expectation.

I don't see any switches, so reading switch states doesn't seem like a useful thing to do.

You didn't post a link to the HCPCA9685 library.

Code source from this guy:
https://www.instructables.com....

Stop right their. Never use instructables unless you know more that the author. About 98% of the time it is crap. What is it with all the crucifix symbols?

Never use instructables unless you know more that the author.

A drunken monkey knows more that most instructable authors, 98% of the time.

I can't find information where they explain how to connect pro mini with a servo.

As far as servos go a Pro Mini is no different with respect to connecting servos than an Uno or any other Arduino for that matter with the possible exception of a Due and Zero.

Now can you find the correct information?

So are you saying the Sweep program doesn't run? Or is it just your test.txt program with the 14 servos that you don't have that doesn't run?

In the messy picture you have red/black/orange wires coming from the servo. And you have red/black/white wires going into the servo connector. If you don't actually plug the servo into the Arduino it's never going to work. And I can't see exactly where it's connected but it definitely isn't pin 9. And if you're thinking of running 14 servos from USB power that's not going to work either.

So there seems to be quite a lot you're not telling us.

Steve