Steven Brison / Mbed 2 deprecated UselessBox

Dependencies:   mbed

Revision:
0:ab9d6f1ea254
diff -r 000000000000 -r ab9d6f1ea254 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Nov 25 12:00:22 2016 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+
+DigitalIn switch1(p17);                               //Switch in original position
+DigitalIn switch2(p18);                               //Switch turned to the right position
+DigitalIn killswitch(p23);                            
+DigitalOut transistor1(p21);
+DigitalOut transistor2(p22);
+
+
+int main() {
+    while(1) {
+    
+     if (switch1==0&& switch2==1&& killswitch==0){           //If the switch is in the orignial position the kill switch is closed
+          transistor1=0;                                          //transistor 1 is off
+          transistor2=0;                                          //trnsistor 2 is off
+          }
+    else if (switch1==1&& switch2==0){                          //If the switch is in the right position
+          transistor1=1;                                         //Transistor 1 is off
+          transistor2=0;                                       //Transistor 2 is on so the motor is working clockwise
+          }   
+    else if (switch1==0&& switch2==1&& killswitch==1){        //If the switch is back in the original position and the kill switch is open 
+          transistor1=0;                                        //Transistor 1 is on 
+          transistor2=1;                                         //Transisotr 2 is off and since transistor 1 is on the motor will work anticlockwise
+          }     
+    
+    }
+}