Hi, thanks for looking at my problem.
I am having trouble combining the functionally of InterruptIn and PwmOut.
If I only use the InterruptIn, the input pin can be low or high as I intend it.
If I simply output the PWM from the mbed to my EasyDrivers to run my steppers, the motors work as I want.
However, when I attempt to use the InterruptIn to trigger my steppers, the mbed behaves as if the InterruptIn is always high.
Has anyone else had this problem, and if so, how did you solve it?
Here is some of my code.
int main() {
srand(time(NULL));
motordir1 = 0;
motordir2 = 0;
motordir3 = 0;
motordir4 = 0;
motor1.period(0.0032);
motor2.period(0.0032);
motor3.period(0.0032);
motor4.period(0.0032);
start.rise(&strt);
finish.rise(&fnsh);
inmaze1.rise(&nmze1);
inmaze2.rise(&nmze2);
inmaze3.rise(&nmze3);
while(1) {
led4 = !led4;
wait(0.25);
}
}
Here is how the EasyDrivers are used
void RunMotor1(void)
{
led1 = 1;
switch(motorcond1)
{ case true:
motordir1 = 0;
motor1.pulsewidth(0.0016);
wait(motor_time);
motor1.pulsewidth(0);
motorcond1=false;
break;
case false:
motordir1 = 1;
motor1.pulsewidth(0.0016);
wait(motor_time);
motor1.pulsewidth(0);
motorcond1=true;
break;
default:
}
ledoff();
wait(1);
}
Thank you very much for your time.
Hi, thanks for looking at my problem.
I am having trouble combining the functionally of InterruptIn and PwmOut. If I only use the InterruptIn, the input pin can be low or high as I intend it. If I simply output the PWM from the mbed to my EasyDrivers to run my steppers, the motors work as I want. However, when I attempt to use the InterruptIn to trigger my steppers, the mbed behaves as if the InterruptIn is always high.
Has anyone else had this problem, and if so, how did you solve it?
Here is some of my code.
Here is how the EasyDrivers are used
Thank you very much for your time.