Nehal Mathur / Mbed 2 deprecated jenga_robot_base

Dependencies:   mbed

Revision:
0:3f81076404ad
Child:
1:55c209e14e75
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 16 10:18:43 2017 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+
+DigitalOut M3_DIR (D4);
+DigitalIn button1(SW3);
+DigitalIn button2(SW2);
+PwmOut M3 (D5);
+DigitalOut led_red_base(LED_RED);
+
+float frequency_pwm = 10000.0f;
+
+
+int main()
+{
+    M3.period(1.0f/frequency_pwm);
+   
+    while(true) {
+
+       if(button1)
+        {
+              M3.write(0.0f);
+        }
+        else
+        {
+            M3.write(0.03f);
+            M3_DIR.write(1);
+        }
+        
+        if(button2)
+        {
+            M3.write(0.0f);
+        }
+        else
+        {
+            M3.write(0.03f);
+            M3_DIR.write(0);
+        }
+    }
+    
+   return 0;
+   
+}
+