H2M Teststand / Mbed 2 deprecated H2M_Snippets

Dependencies:   mbed

Fork of Low_Cost_PWM by Hans Dampf

Revision:
0:13b8e78aee30
Child:
1:dadef2f723e4
diff -r 000000000000 -r 13b8e78aee30 Main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Main.cpp	Mon Sep 08 23:24:48 2014 +0000
@@ -0,0 +1,52 @@
+#include "mbed.h"
+
+//*******************************************
+//****INPUTS*********************************
+PwmOut Motor_Fet(p21);
+
+DigitalIn Light_Barrier(p17);
+
+
+
+
+//*******************************************
+//****MAIN***********************************
+
+int main()
+{
+    bool Light_stop = 0;
+    int counter = 0, RPM_S = 0;
+    
+    Motor_Fet.period_us(20000);
+    Motor_Fet.pulsewidth_us(200);
+
+    //***************((((((((((((((()))))))))))))
+    //***MAIN-PROG***((((((((((((((()))))))))))))
+   
+    while(1) 
+    {
+        //**************************LIGHTBARRIER*******************************
+        
+        if (!Light_Barrier)         //Detects Falling Edge of the Light_Barrier
+        {
+            if (!Light_stop)        //Asures First Run since detected Edge
+            {      
+                counter++;          
+                Light_stop = 1;     //Asures just one counter-increase per Falling Edge -> Locks counter increase
+            }         
+        }
+        else
+        Light_stop = 0;             //Unlocks counter-increase when theres no falling edge
+        
+        //**************************LIGHTBARRIER*******************************
+    
+    
+        //**************************Specified-rpm******************************
+        
+        
+    
+    
+    }
+
+    
+}