Need help 3 servo control with arduino uno

hello, i want to control 3 server, servo1, servo , servo 3,

servo 1 start moving 45º and stop, after 8hours servo2 move 45ºand stop, ather 8hours some for servo3, after 8hours servo1 moving and stop. ......

thanks in advance

Thanks for telling Your plans. I, and likely nobody else, has done just this before. Thanks for the idea.

1 Like

What work have you done, so far?

…..

*/
void setup() {

servol.attach(3)
servo2.attach(5)
servo3.attach(6);

void loop() {

servol.write(45):
delay(xxxx);
servo2.write(45);
delay(xxxx);
servo3.write(45);
delay(xxxx);

That will not even compile. Any wiring used? Schematics and a serious code please!

Please post any code in code tags, as the forum guidelines advise.

What does that mean? Back to 0? Move forward by a further 45? If so, does this go on forever? What happens when the servo gets to the end of its travel at say 180?

Good start except write(45) means go to position 45. If the servo is already at position 45 and you do another write(45) it won't move because it's already where you're asking it to go to. I don't think that's what you want. So you're going to need to state your requirements more clearly.

Steve

Hi, @davidparis
Welcome to the forum.

Can you please tell us the application of your project?

Thanks.. Tom... :grinning: :+1: :coffee: :australia:


other servo some conexion

Don't run any motor power through a breadboard. It's not designed for that amount of current.

Post the code used now. Use code tags....

Hi,
Please post your code and tell us what it does?
Please can you post a picture of your project so we can see your component layout and type of protoboard?

A hand drawn schematic would have been better, I assume you are not using a 9V "smokedetector" battery.

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

I see no power going into the Arduino...

...assuming it's a real circuit and not a simulation...

#include <Servo.h>
Servo S1;
Servo S2;
Servo S3;
void setup()
{

S1.attach(3);
S2.attach(5);
S3.attach(6);

}

void loop ()
{

S1.write(0);
delay(2000);
S1.write(90);
delay(28800000);

S2.write(0);
delay(2000);
S2.write(90);
delay(28800000);

S3.write(0);
delay(2000);
S3.write(90);
delay(28800000);
}

or this one with rtc

#include <Servo.h>
#include <LiquidCrystal.h>
#include <DS1302RTC.h>
#include <Time.h>

Servo servo1;
Servo servo2;
Servo servo3;

// Init the DS1302
// Set pins: CE, IO,CLK
DS1302RTC RTC(27, 29, 31);

#define DS1302_GND_PIN 33
#define DS1302_VCC_PIN 35

char DiaSemana[4] = {"Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab"};
DateTime dt(2021, 12, 14, 22, 12, 0, 3);

void setup()
{

servo1.attach(3);
servo1.attach(5);
servo1.attach(6);

digitalWrite(DS1302_GND_PIN, LOW);
pinMode(DS1302_GND_PIN, OUTPUT);

digitalWrite(DS1302_VCC_PIN, HIGH);
pinMode(DS1302_VCC_PIN, OUTPUT);

delay(2000);

setSyncProvider(RTC.get); // the function to get the time from the RTC
if(timeStatus() == timeSet)

void loop() {

servo1.write(0);
servo2.write(0);
servo3.write(0);

DateTime now = rtc.now();
int hora =now.hour();
int minuto =now.minute();
int segundo = now.second();
if(hora >=8 && minuto <=1 ){
servo1.write(180);
}
else {
servo1.write(0);
}

if(hora >=16 && minuto <=1 ){
servo2.write(180);
}
else {
servo3.write(0);
}

if(hora >=00 && minuto <=1 ){
servo3.write(180);
}
else {
servo3.write(0);
}

}

Hi,
To add code please click this link;

Your code in post #15, use some shorter delays and see if you code works.
28800000 = 480mins

To test use 5 or 10 seconds.

Have you physically built your project or is it in the land of simulation?

Tom... :grinning: :+1: :coffee: :australia:

You have posted (incorrectly) two programs. Do either of them work? Did you have any questions about either of them?

Steve