a pacemaker

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
kohlerba
Date:
Wed Oct 26 14:04:14 2016 +0000
Parent:
1:446bd28a1f19
Child:
3:334300ac49e5
Commit message:
pacing works with busy loops.

Changed in this revision

clock.cpp Show annotated file Show diff for this revision Revisions of this file
clock.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/clock.cpp	Wed Oct 26 13:42:57 2016 +0000
+++ b/clock.cpp	Wed Oct 26 14:04:14 2016 +0000
@@ -15,11 +15,3 @@
 double get_time(void){
     return counter;
     }
-    
-int wait_time(double wait_time){
-    while (wait_time > 0){
-        wait_time--;
-        }
-    return 1;
-    }
-    
\ No newline at end of file
--- a/clock.h	Wed Oct 26 13:42:57 2016 +0000
+++ b/clock.h	Wed Oct 26 14:04:14 2016 +0000
@@ -8,6 +8,3 @@
 
 //Returns the clock time
 double get_time(void);
-
-//wait a given amount of time
-int wait_time(double wait_time);
--- a/main.cpp	Wed Oct 26 13:42:57 2016 +0000
+++ b/main.cpp	Wed Oct 26 14:04:14 2016 +0000
@@ -1,21 +1,23 @@
 #include "main.h"
 
 Serial pc(USBTX , USBRX);
-DigitalOut led(LED_GREEN);
+DigitalOut ledg(LED_GREEN);
+DigitalOut ledb(LED_BLUE);
 int main()
 {
-    led = 0;
-    wait(3);
+    ledb = 0;
     pc.printf("connecting...");
     pc.printf("\n\n");
-    led = 1;
+    wait(3);
+    ledb = 1;
+    wait(1);
     start_clock();
     while (true) {
         pc.printf("%d" , get_time());
         pc.printf("\n");
-        led = 0;
+        ledg = 0;
         v_pace_sq(5 , 0.08);
-        led = 1;
+        ledg = 1;
         pc.printf("%d" , get_time());
         pc.printf("\n");
         wait(0.92);