motor code works

Dependencies:   Motor mbed

Revision:
0:64c745fbdf05
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/motor.cpp	Fri Oct 19 14:37:17 2018 +0000
@@ -0,0 +1,25 @@
+//Test Motor
+
+//Libraries and mechanical directives
+#include "Motor.h" //must change line 31 in Motor.cpp according to Lab
+#include "mbed.h"
+//#include "Servo.h" //need Servo library
+
+Motor m(p26, p30, p29); //designates the pins used by the motor
+DigitalIn sw1(p16); //switches or buttons
+int sw1state, bu1state, bu2state, bu3state, bu4state, bu5state; //the state of the switch
+int s=0.6; //speed of motor rotation - fairly slow so as to be exact
+
+int main() {
+    while(1) { //do we need while?
+        sw1state=sw1.read(); //read in switch state
+        
+        if (sw1state == 1) { //if bu4 is on rotate motor fwd
+            m.speed(-s);
+            s=1;
+            printf("hi");}
+            else { //if bu5 is on rotate motor rev
+            m.speed(s);
+            s=0;}
+        }
+    }