Below is a picture of a 12V barrel jack converter supplying 12V to the LMD18200T and connecting the GND, PWM, DIR and BRAKE pins to pins GND, 9, 5, and 6 of the Arduino nano, respectively. Arduino nano is receiving power from the USB terminal of the laptop.
And the code below is a simple Arduino code for testing LMD18200T. I thought through this code that the potential difference between OUT1 and OUT2 would be equal to 12V multiplied by the supply voltage of 12V (255/255), but actually, the voltage between the two terminals was measured to be approximately 0.82V. According to the uploaded Arduino code, the maximum value of 255 was delivered to PWM, DIR delivered HIGH and BRAKE delivered LOW signals, which was expected to be similar to the voltage supplied by the motor driver, but a much lower value was output. How do I make a value equivalent to 12V output?
// Pin Definitions
const int pwmPin = 9; // PWM pin (connected to LMD18200T pin 9)
const int dirPin = 5; // Direction pin (connected to LMD18200T pin 5)
const int brakePin = 6; // Brake pin (connected to LMD18200T pin 6)
// Motor Control Parameters
const int speed = 0; // Motor speed (0-255)
void setup() {
// Initialize the motor control pins as outputs
pinMode(pwmPin, OUTPUT);
pinMode(dirPin, OUTPUT);
pinMode(brakePin, OUTPUT);
}
void loop() {
// Set the motor direction
digitalWrite(brakePin, LOW); // Apply brake by setting the brake pin HIGH
digitalWrite(dirPin, HIGH); // Set HIGH for one direction, LOW for the other
// Apply PWM to control the motor speed
//analogWrite(pwmPin, 0); // Set HIGH for one direction, LOW for the other
analogWrite(pwmPin, 127); // Set HIGH for one direction, LOW for the other
// Wait for a few seconds
// Brake the motor
// Wait for a few seconds
delay(5000);
}