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.
Revision 11:f23a77c2296d, committed 2021-02-10
- Comitter:
- mfurukawa
- Date:
- Wed Feb 10 21:59:00 2021 +0000
- Branch:
- MPU-9250-MagSensServo
- Parent:
- 10:f5a805d998d6
- Commit message:
- e
Changed in this revision
KST_Servo.h | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/KST_Servo.h Wed Feb 03 06:01:27 2021 +0000 +++ b/KST_Servo.h Wed Feb 10 21:59:00 2021 +0000 @@ -48,9 +48,9 @@ #define KST_SERVO_USEC_MIN 900 // -60deg #define KONDO_SERVO_KRS2572HV_USEC_MAX 3000 // 60deg -#define KONDO_SERVO_KRS2572HV_USEC_180 2800 // 60deg -#define KONDO_SERVO_KRS2572HV_USEC_MID 1750 // 0deg -#define ONDOT_SERVO_KRS2572HV_USEC_MIN 1100 // -60deg +#define KONDO_SERVO_KRS2572HV_USEC_180 2800 // 180deg +#define KONDO_SERVO_KRS2572HV_USEC_90 1950 // 90deg +#define ONDOT_SERVO_KRS2572HV_USEC_MIN 1100 // 0deg #endif // __KST_SERVO_H__ \ No newline at end of file
--- a/main.cpp Wed Feb 03 06:01:27 2021 +0000 +++ b/main.cpp Wed Feb 10 21:59:00 2021 +0000 @@ -88,7 +88,7 @@ Mseries m; // M-series update flag -#define M_TERM 100; +#define M_TERM 200; int m_cnt = M_TERM; #define BINARY_MODE 0 @@ -97,6 +97,7 @@ #define CSV_TITLE_COLUMN "smpl_cnt,time[sec],M_stat,accX,accY,accZ,gyroX,gyroY,gyroZ,magX,magY,magZ,accX,accY,accZ,gyroX,gyroY,gyroZ,magX,magY,magZ,\r\n" +void stop_dump(void); void servo_test(void) { @@ -104,7 +105,7 @@ if(m.update()) pwm_.pulsewidth_us(ONDOT_SERVO_KRS2572HV_USEC_MIN); else - pwm_.pulsewidth_us(KONDO_SERVO_KRS2572HV_USEC_180); + pwm_.pulsewidth_us(KONDO_SERVO_KRS2572HV_USEC_90); wait(.5); } @@ -204,7 +205,7 @@ if(m.get()) pwm_.pulsewidth_us(ONDOT_SERVO_KRS2572HV_USEC_MIN); else - pwm_.pulsewidth_us(KONDO_SERVO_KRS2572HV_USEC_180); + pwm_.pulsewidth_us(KONDO_SERVO_KRS2572HV_USEC_90); m_cnt = M_TERM; } @@ -267,6 +268,16 @@ putc(13, stdout); //0x0d CR(復帰) putc(10, stdout); //0x0a LF(改行) + + // auto-stop when 15sec after + if(smpl_cnt>3000){stop_dump();} +} + +void stop_dump(void) +{ + ticker.detach(); + timer.stop(); + smpl_cnt = 0; } int main() @@ -282,9 +293,7 @@ switch(c) { case 'r': - ticker.detach(); - timer.stop(); - smpl_cnt = 0; + stop_dump(); break; case 'R':