NagaokaRoboticsClub_mbedTeam / IR2302

Dependents:   2021_NHK_A_MDandServoSet 2021_NHK_A

Files at this revision

API Documentation at this revision

Comitter:
umekou
Date:
Sat Oct 16 06:23:45 2021 +0000
Parent:
3:58ce9b5cceca
Commit message:
improve full space to half space

Changed in this revision

IR2302.cpp Show annotated file Show diff for this revision Revisions of this file
IR2302.h Show annotated file Show diff for this revision Revisions of this file
--- a/IR2302.cpp	Sat Oct 16 05:59:14 2021 +0000
+++ b/IR2302.cpp	Sat Oct 16 06:23:45 2021 +0000
@@ -1,26 +1,26 @@
 #include "IR2302.h"
 
 IR2302::IR2302(PinName pin_a, PinName pin_b):
-    pwm_A(pin_a),pwm_B(pin_b)
+    A(pin_a),B(pin_b)
 {
-    pwm_A.period(1/20000.0); //周波数設定(20kHz)
-    pwm_B.period(1/20000.0); //周波数設定(20kHz)
+    A.period(1/20000.0);  //周波数設定(20kHz)
+    B.period(1/20000.0);  //周波数設定(20kHz)
     speed=0;
 }
 
 void IR2302::SetMotorSpeed(double speed)
 {
     if((speed>1)||(speed<-1)){
-        pwm_A=0;
-        pwm_B=0;
+        A=0;
+        B=0;
     }else if(speed>0){
-        pwm_A=0.95*speed;
-        pwm_B=0;
+        A=0.95*speed;
+        B=0;
     }else if(speed<0){
-        pwm_A=0;
-        pwm_B=-0.95*speed;
+        A=0;
+        B=-0.95*speed;
     }else{
-        pwm_A=0;
-        pwm_B=0;
+        A=0;
+        B=0;
     }
 }
--- a/IR2302.h	Sat Oct 16 05:59:14 2021 +0000
+++ b/IR2302.h	Sat Oct 16 06:23:45 2021 +0000
@@ -55,8 +55,8 @@
 
 private:
     double speed;
-    PwmOut pwm_A;
-    PwmOut pwm_B;
+    PwmOut A;
+    PwmOut B;
 
 };