with optic sensor
Dependencies: Stepper mbed PinDetect
Diff: main.cpp
- Revision:
- 3:5410ddd83592
- Parent:
- 2:65c5232b9465
- Child:
- 4:82cd644fef51
--- a/main.cpp Wed Sep 04 18:03:54 2019 +0000 +++ b/main.cpp Wed Sep 04 18:57:27 2019 +0000 @@ -19,19 +19,20 @@ while(1) { pc.printf("\n\n\nEnter desired position: "); - pc.scanf("%d",&slot); + pc.scanf("%d",&slot); + en = 0; //turns on stepper driver - mot.goesTo(slot*100); // move to absolute 100 + mot.goesTo(slot*1000); // move to absolute slot*500 step position while(!mot.stopped()); // while motor is turning...do line below steps = mot.getPosition(); //read in absolute step postition - while(optic == 0) - { - wait(1); - mot.goesTo(steps+25); //go to absolute step position - while(!mot.stopped()); - steps = mot.getPosition(); - pc.printf("\nNot in Position", steps); - } + //while(optic == 0) + //{ + //wait(1); + //mot.goesTo(steps+25); //go to absolute step position + //while(!mot.stopped()); + //steps = mot.getPosition(); + //pc.printf("\nNot in Position", steps); + //} pc.printf("\nIn Position"); en = 1; //disable the motor and driver //if (tickcount<steps)