GeoffKnight
New Member
Much appreciated if someone can advise on the following:-
I have run a small 5VDC motor / gearbox directly with the 18M2 chip, pin B.6 as below, & have had success experimenting with duty & cycle parameters to get good speed control etc.
test:
pwmout B.6,99,250
main:
pwmduty B.6,250
pause 3000
pwmduty B.6,50
pause 3000
pwmout B.6, Off
Question is..how do I get rid of the "pause" lines and substitute a "if" or "do" loop, so that the motor starts, & runs until one of two possible input's into say C.0 or C.1 is detected. I can't get the motor to run continuously (only pulse) and don't know where to put the if or do... loop.
This is what I tried & failed with:-
test:
pwmout B.6,99,250
If C.0 = 1
{pwmout B.6,OFF
goto main}
Elseif C.1 = 1
{pwmout B.6,OFF
goto main}
Else
{goto test}
Endif
thanks
I have run a small 5VDC motor / gearbox directly with the 18M2 chip, pin B.6 as below, & have had success experimenting with duty & cycle parameters to get good speed control etc.
test:
pwmout B.6,99,250
main:
pwmduty B.6,250
pause 3000
pwmduty B.6,50
pause 3000
pwmout B.6, Off
Question is..how do I get rid of the "pause" lines and substitute a "if" or "do" loop, so that the motor starts, & runs until one of two possible input's into say C.0 or C.1 is detected. I can't get the motor to run continuously (only pulse) and don't know where to put the if or do... loop.
This is what I tried & failed with:-
test:
pwmout B.6,99,250
If C.0 = 1
{pwmout B.6,OFF
goto main}
Elseif C.1 = 1
{pwmout B.6,OFF
goto main}
Else
{goto test}
Endif
thanks