Carrito Arduino con RF
0:49
Cpp
// Pines asignados para el puente H const int IN1 = 7; // Dirección 1 const int IN2 = 8; // Dirección 2 const int ENA = 9; // PWM para velocidad void setup() { // Configurar pines como salida pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(ENA, OUTPUT); // Inicialmente detenemos el motor detenerMotor(); } void loop() { // Avanzar el motor avanzar(); delay(3000); // 3 segundos adelante // Detener el motor por un momento detenerMotor(); delay(1000); // Retroceder el motor retroceder(); delay(3000); // 3 segundos atrás // Detener el motor detenerMotor(); delay(1000); } void avanzar() { // Para avanzar: IN1 en HIGH, IN2 en LOW digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); // Establecer velocidad (valor PWM de 0 a 255) analogWrite(ENA, 200); } void retroceder() { // Para retroceder: IN1 en LOW, IN2 en HIGH digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH); analogWrite(ENA, 200); } void detenerMotor() { // Para detener, ponemos ambos pines en LOW y velocidad 0 digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); analogWrite(ENA, 0); }
analogWrite(ENA, 200) para ajustar la velocidad del motor.Ready.
Reviews
Properties
Properties describe core aspects of the project.
Pricing & Availability
Distributor | Qty 1 |
|---|
Assets
No assets added.
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.