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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 26:abb0cc9a1dd2
- Parent:
- 25:371af8d95c69
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;
+ }
+
}
}