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.
main.cpp
- Committer:
- Amwila
- Date:
- 2017-10-03
- Revision:
- 1:6017f9971cc8
- Parent:
- 0:2a502be30ec8
- Child:
- 2:4772acaa0e64
File content as of revision 1:6017f9971cc8:
#include "mbed.h"
// Interrupt Initialisation
InterruptIn BLM_CHANNEL_A(PG_5);
//Variable Initialisation
int A_count = 0 ;
int FinalCountTime =0 ;
Timer Count_Timer ;
// Interrupt Counter Increment Function
void IncA()
{
A_count ++ ;
printf("%d",A_count);
}
int main()
{
while (true) {
if (A_count == 1)
{
// Starting timer at 1 Count
Count_Timer.start();
}
if (A_count == 10000)
{
// Stopping timer at 10000 Counts
Count_Timer.stop();
// Reading Counter Time
FinalCountTime = Count_Timer.read();
// Outputting Final count to Terminal
printf("Final Count Time for 10000 counts is : %d ",FinalCountTime);
//Setting Counter to 0 again
A_count = 0;
}
// Calling of the increment function on the rising edge of a pulse
BLM_CHANNEL_A.rise(&IncA);
}
}