linear motor code for ksk
Revision 2:81a944155520, committed 2017-02-25
- Comitter:
- cws8262
- Date:
- Sat Feb 25 08:14:13 2017 +0000
- Parent:
- 1:ff295adcca59
- Commit message:
- ds
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Feb 24 16:06:21 2017 +0000
+++ b/main.cpp Sat Feb 25 08:14:13 2017 +0000
@@ -15,9 +15,19 @@
void move(double dis, double spd);
void init(void);
+void pause(void);
+InterruptIn psw(PA_8);
+DigitalIn psw_(PA_8);
int main() {
+
+ psw_.mode(PullUp);
+ pc.baud(230400);
+ if(psw_.read()) pc.printf("\n\rPause.... ");
+ while(psw_.read());
+ pc.printf("Start");
+ wait_ms(20);
- pc.baud(230400);
+ psw.rise(&pause);
lm.st=1;
wait_ms(500);
init();
@@ -89,4 +99,13 @@
i++;
}
pc.printf("Complete\n\r");
+}
+
+void pause(void){
+ psw.disable_irq();
+ wait_ms(20);
+ pc.printf("\n\rPause....");
+ while(psw_.read());
+ pc.printf(" Resume\n\r");
+ psw.enable_irq();
}
\ No newline at end of file