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:
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.
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
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. They don't provide enough information to guess the motor stall current and you will need to know that.
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.