![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
3m
Dependencies: mbed
Fork of hudo by
main.cpp
00001 #include "mbed.h" 00002 00003 #define SERVODEG 0.0 00004 #define MaxDeg 25.0 00005 00006 PwmOut servo(p21); 00007 AnalogIn input(p20); 00008 double bairitu; 00009 00010 double calcPulse(int deg){ 00011 return (0.0006+(deg/180.0)*(0.00235-0.00045)); 00012 } 00013 00014 int main() { 00015 while(1){ 00016 bairitu = (input-0.5)*2; 00017 servo.pulsewidth(calcPulse(71.0 + SERVODEG + bairitu*MaxDeg));//calcPulse = 90の時がニュートラル 00018 wait(0.1); 00019 } 00020 }
Generated on Sun Aug 21 2022 08:31:47 by
![doxygen](doxygen.png)