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.
Dependencies: RemoteIR TextLCD
Diff: main.cpp
- Revision:
- 39:054c17d10c55
- Parent:
- 38:39db3f7450c2
- Child:
- 40:75e1ad7c27e4
--- a/main.cpp Tue Aug 18 08:13:07 2020 +0000
+++ b/main.cpp Wed Aug 19 01:53:11 2020 +0000
@@ -58,7 +58,7 @@
int beforeMode; // 前回のモード
int flag_sp = 0; // スピード変化フラグ
Timer viewTimer; // スピ―ド変更時に3秒計測タイマー
-float motorSpeed[9] = {0.5, 0.8, 0.9, 0.75, 0.85, 0.95, 0.8, 0.9, 1.0};
+float motorSpeed[9] = {0.6, 0.7, 0.8, 0.7, 0.8, 0.9, 0.8, 0.9, 1.0};
// モーター速度設定(後半はライントレース用)
Mutex mutex; // ミューテックス
@@ -76,7 +76,7 @@
int flag_t = 0; // バックライトタイマーフラグ
/* trace用変数 */
-int sensArray[32] = {8,6,2,4,1,1,2,2, // ライントレースセンサパターン
+int sensArray[32] = {0,6,2,4,1,1,2,2, // ライントレースセンサパターン
3,1,1,1,3,1,1,2,
7,1,1,1,1,1,1,1,
5,1,1,1,3,1,3,1};
@@ -328,19 +328,19 @@
run = ADVANCE; // 低速で前進
break;
case 2:
- flag_sp = flag_sp % 3 + 6;
+// flag_sp = flag_sp % 3 + 6;
run = RIGHT; // 低速で右折
break;
case 3:
- flag_sp = flag_sp % 3 + 6;
+// flag_sp = flag_sp % 3 + 6;
run = LEFT; // 低速で左折
break;
case 4:
- flag_sp = flag_sp % 3 + 6;
+ flag_sp = flag_sp % 3 + 3;
run = RIGHT; // 中速で右折
break;
case 5:
- flag_sp = flag_sp % 3 + 6;
+ flag_sp = flag_sp % 3 + 3;
run = LEFT; // 中速で左折
break;
case 6:
@@ -351,8 +351,8 @@
flag_sp = flag_sp % 3 + 6;
run = LEFT; // 高速で左折
break;
- case 8:
- break;
+ default:
+ break; // 前回動作を継続
}
ThisThread::sleep_for(30); // 30ms待つ
}