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 3:6a42c3c3d816, committed 2018-10-30
- Comitter:
- kamorei
- Date:
- Tue Oct 30 06:32:38 2018 +0000
- Parent:
- 2:8748af75523f
- Commit message:
- 10/30 ?????
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Oct 30 06:24:21 2018 +0000 +++ b/main.cpp Tue Oct 30 06:32:38 2018 +0000 @@ -182,6 +182,7 @@ break; } } + //以下トンネル内部 if( i < 2){ turn_right(); @@ -191,6 +192,9 @@ turn_right(); if( sensor[3] <= blackR){ stop_turn_right(); + + wait(0.5); + break; } } @@ -203,7 +207,9 @@ white_tunnel = sensorL.read(); gray_tunnel = (white_tunnel - black_tunnel) / 2; - while(1){ //姿勢を直す + + //姿勢を直す + while(1){ sensor[3] = sensorR.read(); turn_left(); if( sensor[3] <= blackR){ @@ -211,6 +217,28 @@ break; } } + + //トンネルに入る + while(1){ + sensor[0] = sensorL.read(); + sensor[1] = sensorCL.read(); + sensor[2] = sensorCR.read(); + sensor[3] = sensorR.read(); + + pr = (sensor[2] - black) / (white - black); + pl = (sensor[1] - black) / (white - black); + + go_straight_p(); + + if( sensor[1] < gray_tunnel && sensor[2] < gray_tunnel){ + stop_point(); + ledRR = 0b11; //←2進数表記使える…? + wait(0.5); + break; + } + } + + //トンネルの中でのトレース while(1){ sensor[0] = sensorL.read(); sensor[1] = sensorCL.read();