Arduino leonardo output voltage low

I am making an Arduino car with this four wheel drive chassis https://www.jaycar.com.au/4-wheel-drive-motor-chassis-robotics-kit/p/KR3162
When i upload the code whether the jumpers are connected to the motors or not i get 100mv on my multimeter
Here is the code

int starFor = 10;
int starRev = 9;
int portFor = 13;
int portRev = 11;

void setup() {
  pinMode(starFor, OUTPUT);
  pinMode(starRev, OUTPUT);
  pinMode(portFor, OUTPUT);
  pinMode(portRev, OUTPUT);
}

void loop() {
  analogWrite(starFor, HIGH);
  analogWrite(portFor, HIGH);
  analogWrite(starRev, LOW);
  analogWrite(portRev,LOW);
}

commiccannon:
whether the jumpers are connected to the motors or not i get 100mv on my multimeter

What jumpers?

Where are you trying to measure the voltage?

...R

As LOW equals 0 and HIGH equals 1, your analogWrites translate to

  analogWrite(starFor, 1);
  analogWrite(portFor, 1);
  analogWrite(starRev, 0);
  analogWrite(portRev, 0);

So extremely low duty cycles.

Try analogWrite(starFor, 255); ; that should result in 5V on the startFor pin.

You can't really measure PWM signals with a multimeter; it will average the signal. With e.g. analogWrite(portFor, 128);, you should get a better reading (might be 2.5V, not sure).

You are using analogWrite, but writing the value HIGH, which is = 1. The analogWrite() function uses pulse-width modulation to approximate analog voltages. A value of 0 will give 0 volts, and a value of 255 will give a value of 5v. Intermediate values will approximate intermediate voltages. (It will actually send pulses of 5V with varying duty cycles from 0% to 100%.

If you want your output to be full off or full on, use DigitalWrite HIGH or LOW, or use analogWrite with a value of 255.

commiccannon:
I am making an Arduino car with this four wheel drive chassis https://www.jaycar.com.au/4-wheel-drive-motor-chassis-robotics-kit/p/KR3162
When i upload the code whether the jumpers are connected to the motors or not i get 100mv on my multimeter
Here is the code

int starFor = 10;

int starRev = 9;
int portFor = 13;
int portRev = 11;

void setup() {
  pinMode(starFor, OUTPUT);
  pinMode(starRev, OUTPUT);
  pinMode(portFor, OUTPUT);
  pinMode(portRev, OUTPUT);
}

void loop() {
  analogWrite(starFor, HIGH);
  analogWrite(portFor, HIGH);
  analogWrite(starRev, LOW);
  analogWrite(portRev,LOW);
}

Have tried to fix but it is still not working

analogWrite(starFor, 255);
  analogWrite(portFor, 255);
  analogWrite(starRev, 0);
  analogWrite(portRev,0);

any ideas the led on pin 13 is on but the motor is not running
I have also tried on another arduino leanardo

How is the motor connected? What kind of motor (link please).

commiccannon:
Have tried to fix but it is still not working

[....]

any ideas the led on pin 13 is on but the motor is not running
I have also tried on another arduino leanardo

You are not providing enough information from which to help you. Give full details of what you tried and what exactly "still not working" means. What does it actually do and what do you want it to do that is different?

Why do you think the LED on pin 13 is relevant? If we know what you are thinking it is much easier to help - especially if you have the wrong concept in your mind.

...R

sterretje:
How is the motor connected? What kind of motor (link please).

i am using the motors on this kit https://www.jaycar.com.au/4-wheel-drive-motor-chassis-robotics-kit/p/KR3162

How did you connect the motor to the Arduino? Directly or via a motor driver shield?

Are there any specifications on the motor? In the link it says 5V-10V, but it does not give a current rating.

Robin2:
You are not providing enough information from which to help you. Give full details of what you tried and what exactly "still not working" means. What does it actually do and what do you want it to do that is different?

Why do you think the LED on pin 13 is relevant? If we know what you are thinking it is much easier to help - especially if you have the wrong concept in your mind.

...R

sorry i have tried with this code

int starFor = 10;
int starRev = 9;
int portFor = 13;
int portRev = 11;

void setup() {
  pinMode(starFor, OUTPUT);
  pinMode(starRev, OUTPUT);
  pinMode(portFor, OUTPUT);
  pinMode(portRev, OUTPUT);
}

void loop() {
  analogWrite(starFor, 255);
  analogWrite(portFor, 255);
  analogWrite(starRev, 0);
  analogWrite(portRev,0);
}

the motors are still not turning but the light on the same pin is on

sterretje:
How did you connect the motor to the Arduino? Directly or via a motor driver shield?

Are there any specifications on the motor? In the link it says 5V-10V, but it does not give a current rating.

i connected them via a jumper and a breadboard the current rating is 70ma
Is there any other way of providing between 5 and 10v using an arduino?

You can not connect a motor directly to an Arduino. You'll need a driver.

Ask Jaycar what sort of motor driver they recommend for those motors. They don't provide enough information to guess the motor stall current and you will need to know that.

jremington:
Ask Jaycar what sort of motor driver they recommend for those motors.

The one that is actually in stock and has the highest profit margin :slight_smile:

...R

jremington:
Ask Jaycar what sort of motor driver they recommend for those motors. They don't provide enough information to guess the motor stall current and you will need to know that.

The stall current is 150ma

sterretje:
You can not connect a motor directly to an Arduino. You'll need a driver.

OK thanks how then does a light or other thing get power is it just a high power draw of the motor

You can safely draw about 20 milliAmperes (mA) current from a pin (for example one LED with a current limiting resistor). For anything that draws more than 20 mA, you need a driver.

For motors, motor drivers are convenient.

For other things, relays, solid state relays, MOSFET and other types of transistors are used.