n

Dependencies:   Motor mbed

Committer:
pforrestal75
Date:
Mon Feb 22 19:48:22 2016 +0000
Revision:
0:2e26033f5993
z

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pforrestal75 0:2e26033f5993 1 #include "mbed.h"
pforrestal75 0:2e26033f5993 2 #include "Motor.h"
pforrestal75 0:2e26033f5993 3
pforrestal75 0:2e26033f5993 4 DigitalOut spinner(LED1);
pforrestal75 0:2e26033f5993 5 DigitalOut plunger(LED2);
pforrestal75 0:2e26033f5993 6 Motor spinner1(p26,p29,p30);
pforrestal75 0:2e26033f5993 7 Motor plunger1(p26,p29,p30);
pforrestal75 0:2e26033f5993 8
pforrestal75 0:2e26033f5993 9 char button;
pforrestal75 0:2e26033f5993 10 int off;
pforrestal75 0:2e26033f5993 11 int off1;
pforrestal75 0:2e26033f5993 12
pforrestal75 0:2e26033f5993 13 int main()
pforrestal75 0:2e26033f5993 14 {
pforrestal75 0:2e26033f5993 15
pforrestal75 0:2e26033f5993 16 printf("Type s for Spinner");
pforrestal75 0:2e26033f5993 17 scanf("%c",&button);
pforrestal75 0:2e26033f5993 18 while(off==0) {
pforrestal75 0:2e26033f5993 19 if (button=='s') {
pforrestal75 0:2e26033f5993 20 spinner=1;
pforrestal75 0:2e26033f5993 21 spinner1.speed(1);
pforrestal75 0:2e26033f5993 22 while(off1==0) {
pforrestal75 0:2e26033f5993 23 printf("Type p for Plunger");
pforrestal75 0:2e26033f5993 24 scanf("%c",&button);
pforrestal75 0:2e26033f5993 25 if (button=='p') {
pforrestal75 0:2e26033f5993 26 plunger=1;
pforrestal75 0:2e26033f5993 27 plunger1.speed(1);
pforrestal75 0:2e26033f5993 28 }
pforrestal75 0:2e26033f5993 29 scanf("%c",&button);
pforrestal75 0:2e26033f5993 30 if (button=='p') {
pforrestal75 0:2e26033f5993 31
pforrestal75 0:2e26033f5993 32
pforrestal75 0:2e26033f5993 33 plunger=0;
pforrestal75 0:2e26033f5993 34 plunger1.speed(0);
pforrestal75 0:2e26033f5993 35 off1=1;
pforrestal75 0:2e26033f5993 36 }
pforrestal75 0:2e26033f5993 37 }
pforrestal75 0:2e26033f5993 38 }
pforrestal75 0:2e26033f5993 39 scanf("%c",&button);
pforrestal75 0:2e26033f5993 40 if(button=='s') {
pforrestal75 0:2e26033f5993 41 spinner=0;
pforrestal75 0:2e26033f5993 42 spinner1.speed(0);
pforrestal75 0:2e26033f5993 43 off=1;
pforrestal75 0:2e26033f5993 44 }
pforrestal75 0:2e26033f5993 45
pforrestal75 0:2e26033f5993 46 }
pforrestal75 0:2e26033f5993 47
pforrestal75 0:2e26033f5993 48
pforrestal75 0:2e26033f5993 49
pforrestal75 0:2e26033f5993 50
pforrestal75 0:2e26033f5993 51
pforrestal75 0:2e26033f5993 52
pforrestal75 0:2e26033f5993 53
pforrestal75 0:2e26033f5993 54 }