The motor runs at half the speed

rva1945:
Hi:

I read the pulse (1 to 2 ms) and map it to a -255,255 range. Then I analogWrite the absolute value (abs()) in the pin that goes to the enable pin in a L293. But the motor barely run at half the speed. The battery is well charged because if I connect the motor directly to it it will run at the right speed.

What am I doing wrong?

Thanks

Using an L293.

This chip has darlington output drivers, which waste 1.0 to 1.5V each (top
and bottom) when carrying significant current, so yout motor will see about 2.5V
less than the battery/supply voltage. You either have to allow for that by using
a higher supply voltage or change to using a better driver chip such as a MOSFET
H-bridge. (I assume you have about 6V supply and 6V motor?)

And if its the L293B (as opposed to L293D) its essential to use 4 free-wheel
diodes as shown in the datasheet or you can damage/destroy the driver.