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.
Diff: main.cpp
- Revision:
- 1:6017f9971cc8
- Parent:
- 0:2a502be30ec8
- Child:
- 2:4772acaa0e64
--- a/main.cpp Tue Oct 03 10:07:16 2017 +0000
+++ b/main.cpp Tue Oct 03 17:54:57 2017 +0000
@@ -1,41 +1,48 @@
-#if !FEATURE_LWIP
- #error [NOT_SUPPORTED] LWIP not supported for this target
-#endif
-
#include "mbed.h"
+// Interrupt Initialisation
InterruptIn BLM_CHANNEL_A(PG_5);
-InterruptIn BLM_CHANNEL_B(PG_4);
-int A_count = 0 ;
-int B_count = 0;
-
-void IncB()
-{
- B_count ++ ;
- printf("%d", B_count);
- }
+//Variable Initialisation
+int A_count = 0 ;
+int FinalCountTime =0 ;
+Timer Count_Timer ;
+// Interrupt Counter Increment Function
void IncA()
{
A_count ++ ;
printf("%d",A_count);
}
-
-
-char Count[10] = "Hello";
-
-int main()
+
+ int main()
{
- printf("Man this actually works");
- printf("This is my attempt to conduct a TCP Send \n");
-
+
while (true) {
- BLM_CHANNEL_A.rise(&IncA);
- BLM_CHANNEL_B.rise(&IncB);
+ 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);
- printf("Count so far for Channel A:%d \n Count so far for Channel B : %d ",A_count ,B_count);
- wait(2);
+ //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);
+
+
}
}