Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:ab9d6f1ea254, committed 2016-11-25
- Comitter:
- wesqeek
- Date:
- Fri Nov 25 12:00:22 2016 +0000
- Commit message:
- .
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /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
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Nov 25 12:00:22 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9bcdf88f62b0 \ No newline at end of file