Arduino Servo Control Code
0:31
Cpp
#include Servo servo1; Servo servo2; // Posiciones iniciales y objetivo int pos1 = 0; int pos2 = 0; int target1 = 180; int target2 = 180; // Velocidades de movimiento (en ms entre pasos) // Ajusta estos valores para cambiar la velocidad (cuanto mayor el delay, menor la velocidad) int speed1 = 10; // Velocidad para servo1 int speed2 = 20; // Velocidad para servo2 void setup() { // Conecta los servomotores a los pines 9 y 10 servo1.attach(9); servo2.attach(10); // Posiciones iniciales servo1.write(pos1); servo2.write(pos2); } void loop() { // Mover servo1 hacia target1 if (pos1 target1) { for (int i = pos1; i >= target1; i--) { servo1.write(i); delay(speed1); } } pos1 = target1; // Mover servo2 hacia target2 if (pos2 target2) { for (int i = pos2; i >= target2; i--) { servo2.write(i); delay(speed2); } } pos2 = target2; // Espera un segundo en las posiciones objetivo delay(1000); // Intercambiar los objetivos para volver a la posición opuesta target1 = (target1 == 180) ? 0 : 180; target2 = (target2 == 180) ? 0 : 180; }
Reviews
Ethnic Jade Liquid Breathing Apparatus
Properties
Properties describe core aspects of the project.
Pricing & Availability
Distributor | Qty 1 |
|---|
Controls
Welcome 👋
Flux helps you build PCBs faster with an AI teammate!
Create your account to collaborate, stay updated, fork your own version, and get instant answers from our AI agent.

AI-Powered Component Placement
Let AI place your components intelligently. AI Placement analyzes your schematic and positions components for optimal routing, signal integrity, and board density.
From Schematic to Layout in Seconds
Skip the tedious manual placement. AI Placement generates a starting layout you can refine, saving hours of repetitive work on every new design.
Works With Auto-Layout
Pair AI Placement with Auto-Layout for a complete AI-driven PCB design flow — from component placement through trace routing, all with one click.