Omni_2017_a

Dependencies:   mbed

Fork of Omni_2017_z by 広田 勇斗

Committer:
hirotayamato
Date:
Sat Aug 05 06:11:16 2017 +0000
Revision:
2:82c337a18500
Parent:
2017_3/MD/MD.cpp@0:fd933ea5f19d
Omni_2017_a

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hirotayamato 0:fd933ea5f19d 1 #include"mbed.h"
hirotayamato 0:fd933ea5f19d 2 #include"MD.h"
hirotayamato 0:fd933ea5f19d 3 MD::MD(PinName pwm,PinName dere):Pwm(pwm),Dere(dere)
hirotayamato 0:fd933ea5f19d 4 {
hirotayamato 0:fd933ea5f19d 5 Pwm.period(0.0001);
hirotayamato 0:fd933ea5f19d 6 }
hirotayamato 0:fd933ea5f19d 7
hirotayamato 0:fd933ea5f19d 8 void MD::rotate(double duty)
hirotayamato 0:fd933ea5f19d 9 {
hirotayamato 0:fd933ea5f19d 10 if(duty > 0)
hirotayamato 0:fd933ea5f19d 11 {
hirotayamato 0:fd933ea5f19d 12 Dere = 0;
hirotayamato 0:fd933ea5f19d 13 Pwm = duty;
hirotayamato 0:fd933ea5f19d 14 }
hirotayamato 0:fd933ea5f19d 15 else
hirotayamato 0:fd933ea5f19d 16 {
hirotayamato 0:fd933ea5f19d 17 Dere = 1;
hirotayamato 0:fd933ea5f19d 18 Pwm = -duty;
hirotayamato 0:fd933ea5f19d 19 }
hirotayamato 0:fd933ea5f19d 20 }