hisyam fs / Mbed 2 deprecated Test_all

Dependencies:   mbed ADS1115 StepperMotor SRF05 TPA81new

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Uvtron.cpp Source File

Uvtron.cpp

00001 #include "Uvtron.h"
00002 
00003 Uvtron::Uvtron(PinName a) : _a(a)
00004 {
00005         Counter=0;
00006         PrevCounter=0;
00007         NextCounter=0;
00008         Flag=0;
00009         _a.mode(OpenDrain);
00010         _a.rise(this, &Uvtron::Count);
00011 }
00012 
00013 void Uvtron::Count()
00014 {
00015         Counter++;
00016 }
00017 
00018 void Uvtron::Read()
00019 {
00020     
00021         PrevCounter = NextCounter;
00022         NextCounter = Counter;
00023 
00024     
00025     if(NextCounter>(PrevCounter+1)&&Flag==0)
00026     {
00027             Flag=1;
00028             Counter=0;
00029     }
00030     else if (NextCounter==PrevCounter&&Flag==1)
00031     {
00032             Flag=0;
00033     }
00034 }
00035 
00036 void Uvtron::UVScan()
00037 {
00038         PrevCounter = NextCounter;
00039         NextCounter = Counter;
00040     
00041         if((NextCounter>PrevCounter) && (FlagScan==0)){
00042                         FlagScan = 1;
00043                         Counter = 0;
00044         }
00045         else{
00046                 //FlagScan = 0;
00047         }
00048 }
00049 
00050 
00051