Motor Driver Stuff
seeing the skeleton libary produced by simon, in the cookbook, I decided that more functions would be nice.
revisions to the libary, due to be published this afternoon,
speed, make it move at a set speed, between -1 and 1. it will not switch from foward to reverse without stopping. returns the speed applied.
coast, motordriver switches off, and does nothing.
stop, motordriver dynamicaly brakes, takes a value between 0 and 1 for duty cycle on PWM, returns duty applied between 0 and 1.
state, returns the state of the motordriver. -3 error -2 braking -1 to 1 speed, 2 coasting.
the latest libary.
http://mbed.org/users/littlexc/libraries/Motordriver/latest
the schematic.
test program
http://mbed.org/users/littlexc/programs/motordrivertestprogram/lieybn
the .cpp has a test function in the comments, so you can use that to test everything is wired up properly. though its the old one, without tons of feedback.
there is an issue with current been sufficent to fry the motor drive under dynamic braking. this is due to the annoying laws of physics. getting round this in hardware is impossible, even with giant heatsinks. this stuff generates heat. software wise, you can PMW the enable whilst holding C and D (read the data sheet, and C, D are inputs 1 and 2 or 3 and 4) high. this limits the current to spikes of current that the system can handle. however it is still possible to fry the IC, if the spikes are high enough/long enough.
unfortunatly I don't know of a way of making the function call run in the background, so revision to this, you can modify the duty on the motor driver. this makes life nicer. i.e a for loop slowly incrementing the duty cycle to near 100%.
<<program http:="" mbed.org="" users="" littlexc="" libraries="" Motordriver="" latest="" docs="" classMotor.html="">>
Please log in to post comments.