Hi guys, I have a project but I'm learning, for now I drive two servos in both directions with one jostyck ps2, my next step is to run an engine, but I am not able to, I need help.
use Arduino UNO and Arduino MEGA2560 and engine shield
// include the library code:
#include <Servo.h>
const int servo1 = 8; // Servo 1
const int servo2 = 9; // Servo 2
const int joyH = 3; // IZquierda / derecha Pin analogico
const int joyV = 4; // Alante / atras Pin analogico
int servoVal; // variable para leer el valor del pin analogico
Servo myservo1; //
Servo myservo2; // Crea un objeto,en este caso un servo
void setup() {
// Servo
myservo1.attach(servo1); //
myservo2.attach(servo2); // attaches the servo
}
void loop(){
// Lee el valor izquierda y derecha ( valor de 0 asta 1023 )
servoVal = analogRead(joyH);
servoVal = map(servoVal, 1023, 0, 180, 0); // Escala entre el 0 y 180
myservo2.write(servoVal); // Establece la posicion deacuerdo al valor
// Lee el valor de arriba y abajo ( valor de 0 asta 1023 )
servoVal = analogRead(joyV);
servoVal = map(servoVal, 1023, 0,180, 0); // Escala entre ( 70 y 180 )
myservo1.write(servoVal); // Establece la posicion deacuerdo al valor
delay(15); // Tiempo de espera
}
I want to make a normal DC motor, with joistyckps2 such as servos work.
Any suggestions, I need help.
Tryiing to drive it as a servo will be useless. Servos are controlled by PWM. The PWM is purely a signal. It is incapable of driving a motor. Servos have the power supplied directly to them separately.
A DC motor needs an entirely different method of control. It will also need an independent power source as the arduino cannot provide enough power to drive a motor.
If it works, what and moved with UBN script Pueba, its library, with USB 5V the motor rotates, whether I can do without power feeding tests with over volts
motoreto:
If it works, what and moved with UBN script Pueba, its library, with USB 5V the motor rotates, whether I can do without power feeding tests with over volts
Sorry, I find this unintelligible. What is your first language?