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
main.cpp
- Committer:
- jtho1327
- Date:
- 2020-01-29
- Revision:
- 26:abb0cc9a1dd2
- Parent:
- 25:371af8d95c69
File content as of revision 26:abb0cc9a1dd2:
#include "mbed.h" #include <iostream> AnalogIn pot(PTB0); PwmOut servo(PTE20); int main() { double val = 0; int count = 0; servo.period(0.02); while(1) { val = 0; for(int i=0; i<200; i++){ wait(0.0001); val = val + pot.read(); } servo.pulsewidth(0.001+(val/200000)); count = count +1; if(count == 10){ cout << "period: " <<((0.001+ val/200000)/0.02)*100 << "%" <<endl; count = 0; } } }