ELCT-302 / Mbed 2 deprecated mbed_blinkyELCT302

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
jtho1327
Date:
Wed Jan 29 19:06:57 2020 +0000
Parent:
25:371af8d95c69
Commit message:
t;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 371af8d95c69 -r abb0cc9a1dd2 main.cpp
--- a/main.cpp	Wed Jan 29 18:35:18 2020 +0000
+++ b/main.cpp	Wed Jan 29 19:06:57 2020 +0000
@@ -6,6 +6,7 @@
 int main() 
 {
     double val = 0;
+    int count = 0;
     servo.period(0.02);
     while(1) 
     {
@@ -15,6 +16,11 @@
             val =  val + pot.read();
         }
         servo.pulsewidth(0.001+(val/200000));
-        cout << (val/200) << endl;
+       count = count +1; 
+       if(count == 10){
+        cout << "period: " <<((0.001+ val/200000)/0.02)*100 << "%" <<endl;
+        count = 0;
+        }
+        
     }
 }