H2M Teststand / Mbed 2 deprecated H2M_Snippets

Dependencies:   mbed

Fork of Low_Cost_PWM by Hans Dampf

Main.cpp

Committer:
Racer01014
Date:
2014-09-08
Revision:
0:13b8e78aee30
Child:
1:dadef2f723e4

File content as of revision 0:13b8e78aee30:

#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******************************
        
        
    
    
    }

    
}