Hi everyone,
I’m currently using Pololu High-Power Motor Driver 36v20 CS for controlling a 24V DC motor using the following arduino code to move forward:
int Dir_MotorRIGHT =4; // Direction input
int PWMH_MotorRIGHT=3;
int PWML_MotorRIGHT=2;
int Dir_MotorLEFT =7; // Direction input
int PWML_MotorLEFT=6;
int PWMH_MotorLEFT=5;
//int motorPin = 11; // Pulse width modulation input
void setup() // run once, when the sketch starts
{
Serial.begin(9600); // set up Serial library at 9600 bps
//pinMode(pot, INPUT);
pinMode(Dir_MotorRIGHT, OUTPUT);
pinMode(PWML_MotorRIGHT, OUTPUT);
pinMode(PWMH_MotorRIGHT, OUTPUT);
pinMode(Dir_MotorLEFT, OUTPUT);
pinMode(PWML_MotorLEFT, OUTPUT);
pinMode(PWMH_MotorLEFT, OUTPUT);
// pinMode(motorPin, OUTPUT);
}
int RobotForward() {
digitalWrite(Dir_MotorRIGHT, HIGH);
digitalWrite(Dir_MotorLEFT, LOW);
digitalWrite(PWML_MotorRIGHT, HIGH);
digitalWrite(PWML_MotorLEFT, HIGH);
digitalWrite(PWMH_MotorRIGHT, HIGH);
digitalWrite(PWMH_MotorLEFT, HIGH);
delay(100);
}
void loop() // run over and over again
{
RobotForward();
}
Now, this moves the robot forward alright, but how do I set the robot to move faster or slower?
Thanks in advance for your time,
Antonio