3m

Dependencies:   mbed

Fork of hudo by albatross

Committer:
YusukeWakuta
Date:
Fri Sep 30 07:51:09 2016 +0000
Revision:
0:a15561fab2ac
Child:
1:28852d0667a9
??????????????????; ?????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
YusukeWakuta 0:a15561fab2ac 1 #include "mbed.h"
YusukeWakuta 0:a15561fab2ac 2
YusukeWakuta 0:a15561fab2ac 3 #define SERVODEG 0
YusukeWakuta 0:a15561fab2ac 4
YusukeWakuta 0:a15561fab2ac 5 PwmOut servo(p21);
YusukeWakuta 0:a15561fab2ac 6
YusukeWakuta 0:a15561fab2ac 7 double calcPulse(int deg){
YusukeWakuta 0:a15561fab2ac 8 return (0.0006+(deg/180.0)*(0.00235-0.00045));
YusukeWakuta 0:a15561fab2ac 9 }
YusukeWakuta 0:a15561fab2ac 10
YusukeWakuta 0:a15561fab2ac 11 int main() {
YusukeWakuta 0:a15561fab2ac 12 while(1){
YusukeWakuta 0:a15561fab2ac 13 servo.pulsewidth(calcPulse(91.4 + SERVODEG * 3.3));//calcPulse = 90の時がニュートラル
YusukeWakuta 0:a15561fab2ac 14 wait(1);
YusukeWakuta 0:a15561fab2ac 15 }
YusukeWakuta 0:a15561fab2ac 16 }