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: mbed line-trace2
Diff: main.cpp
- Revision:
- 2:deefc81cf5a5
- Parent:
- 1:a8fad3c66162
- Child:
- 3:9c86f47e8947
diff -r a8fad3c66162 -r deefc81cf5a5 main.cpp --- a/main.cpp Fri Dec 07 09:34:18 2018 +0000 +++ b/main.cpp Mon Dec 10 11:07:44 2018 +0000 @@ -7,13 +7,13 @@ DigitalOut LED(D2); InterruptIn button1(A1); //フォトインタラプタ InterruptIn button2(A2); //フォトインタラプタ -AnalogIn in1(A3); //フォトリフレクタ左 +AnalogIn in1(A6); //フォトリフレクタ左 AnalogIn in2(A4); //フォトリフレクタ真ん中 -AnalogIn in3(A6); //フォトリフレクタ右 +AnalogIn in3(A3); //フォトリフレクタ右 -float thr1 = 0.70f; -float thr2 = 0.70f; -float thr3 = 0.70f; +float thr1 = 0.40f; +float thr2 = 0.60f; +float thr3 = 0.40f; int judge1 = 0; int judge2 = 0; int judge3 = 0; @@ -62,10 +62,10 @@ */ switch(n){ case(2)://白黒白進む - pwm11.write(0.30f); - pwm12.write(0.00f); - pwm21.write(0.30f); - pwm22.write(0.00f); + pwm11.write(0.60f); + pwm12.write(0.30f); + pwm21.write(0.60f); + pwm22.write(0.30f); break; case(0)://白白白 @@ -74,20 +74,35 @@ pwm21.write(0.10f); pwm22.write(0.10f); break; + + case(1)://黒白白左回転 - pwm11.write(0.20f); - pwm12.write(0.00f); - pwm21.write(0.05f); - pwm22.write(0.00f); + pwm11.write(0.60f); + pwm12.write(0.30f); + pwm21.write(0.66f); + pwm22.write(0.30f); break; case(4)://白白黒右回転 - pwm11.write(0.05f); - pwm12.write(0.00f); - pwm21.write(0.20f); - pwm22.write(0.00f); + pwm11.write(0.59f); + pwm12.write(0.30f); + pwm21.write(0.60f); + pwm22.write(0.30f); break; + + case(3)://黒黒白左回転 + pwm11.write(0.60f); + pwm12.write(0.30f); + pwm21.write(0.66f); + pwm22.write(0.30f); + + case(6)://白黒黒右回転 + pwm11.write(0.59f); + pwm12.write(0.30f); + pwm21.write(0.60f); + pwm22.write(0.30f); + default://それ以外 pwm11.write(0.00f);