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.
Dependents: 2021_NHK_A_MDandServoSet 2021_NHK_A
Revision 4:c365b792d642, committed 2021-10-16
- 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;
};