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
Fork of hudo by
Revision 2:e1b3f635701b, committed 2016-11-23
- Comitter:
- tsumagari
- Date:
- Wed Nov 23 11:31:48 2016 +0000
- Parent:
- 1:28852d0667a9
- Commit message:
- ???????????????????
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 28852d0667a9 -r e1b3f635701b main.cpp
--- a/main.cpp Wed Nov 23 07:53:46 2016 +0000
+++ b/main.cpp Wed Nov 23 11:31:48 2016 +0000
@@ -4,6 +4,8 @@
#define MaxDeg 25.0
PwmOut servo(p21);
+AnalogIn input(p20);
+double bairitu;
double calcPulse(int deg){
return (0.0006+(deg/180.0)*(0.00235-0.00045));
@@ -11,7 +13,8 @@
int main() {
while(1){
- servo.pulsewidth(calcPulse(71.0 + SERVODEG - MaxDeg));//calcPulse = 90の時がニュートラル
- wait(1);
+ bairitu = (input-0.5)*2;
+ servo.pulsewidth(calcPulse(71.0 + SERVODEG + bairitu*MaxDeg));//calcPulse = 90の時がニュートラル
+ wait(0.1);
}
}
