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.
Dependencies: mbed
Fork of Low_Cost_PWM by
Diff: Main.cpp
- Revision:
- 0:13b8e78aee30
- Child:
- 1:dadef2f723e4
--- /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******************************
+
+
+
+
+ }
+
+
+}
