-Hi I was using the library for the motor shield VNH5019 and one of the example said that the maximum speed can be either 400 or -400 in setM1Speed().I wondered is it okay to crank it up higher than that. Thank you.
The largest possible value for speed with this motor driver is 400. Any value sent to the setM1Speed() function that is higher than 400 will simply result in the value 400 being sent. The value 400 represents a PWM signal with 100% duty cycle and corresponds to the motor receiving the full motor supply voltage. It is not physically possible to give the motor a higher voltage than the motor supply voltage.
If you would like more speed, you will need to upgrade your hardware. This might entail using a faster motor or increasing the voltage of your motor supply.
I was wonder if the 400 speed sent translates to current adjustment on the load side assuming voltage stays constant? If so, I am wondering how I can adjust the current range to go between 0 and 29 milliAmps. Can I do decimals with the speed value? I am trying to control a 12v PC fan.
As Zach said, the magnitude of the speed value used in our VNH5019 shield code corresponds to the duty cycle applied by the driver. Our brushed DC motor drivers do not support setting a constant current output. For your application, fans often have a current draw rating for a specific voltage that you could use to estimate the current draw at other voltages/duty cycles.
In our example code, the speed value should be an integer, not a decimal.
By the way, I am not sure if you are considering the same driver that khoitd1997 asked about, our dual VNH5019 shield, but that can deliver a continuous 12A per motor, so it is probably overkill for fans rated for a few dozen milliamps. You would probably be fine with a smaller driver like our DRV8835 shield, or a even just a simple MOSFET and a flyback diode if you do not need direction control.