Hello!
I’m trying to control motor direction using K8055D in Matlab, I’ve connected the motor to the digital outputs using H-bridge.
However, I want the motor direction to change once the value of external pot that is connected to the analog input changes.
Here is the code I worte:
if (calllib('K8055D','ReadAnalogChannel',1)==15)
calllib('K8055D','SetDigitalChannel',1)
pause(1)
calllib('K8055D','SetDigitalChannel',2)
calllib('K8055D','ClearDigitalChannel',1)
end
It works only if the pot was set to 15 before I run the code, otherwise it doesn’t work.
I’ve tried to put the code in a loop but it didn’t work.
I need help please …