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
Diff: main.cpp
- Revision:
- 1:f6b396987546
- Parent:
- 0:7a6b6c687fa3
- Child:
- 2:fef6e8a45d71
--- a/main.cpp Mon Dec 17 05:54:30 2018 +0000
+++ b/main.cpp Mon Dec 17 12:03:51 2018 +0000
@@ -35,7 +35,7 @@
flipper.attach(&flip3,0.05);//0.1秒ごとに回転数cを更新
while(1) {
-
+ /*
if( led_count1 + led_count2 > 43*2*12){ //200mm毎にLEDを点滅
LED = 1.0f;
wait(0.5f);
@@ -43,6 +43,7 @@
led_count1 = 0;
led_count2 = 0;
}
+ */
//////////////////floatのinをintのjudgeに変換
if(in1 > thr1){
judge1 = 1;
@@ -70,13 +71,13 @@
switch(n){
case(2)://白黒白ゆっくり進む
g = 500.0f;
- dif1 = g - c2;
- dif2 = g - c1;
+ dif1 = g - c1;
+ dif2 = g - c2;
gain1 = 0.0006f;
gain2 = 0.0006f;
- pwm11.write(0.45f + dif1*gain1);
+ pwm11.write(0.50f + dif1*gain1);
pwm12.write(0.30f);
- pwm21.write(0.45f + dif2*gain2);
+ pwm21.write(0.50f + dif2*gain2);
pwm22.write(0.30f);
break;
@@ -125,8 +126,8 @@
g = 500.0f;
dif1 = g - c1;
dif2 = g - c2;
- gain1 = 0.0002f;
- gain2 = 0.0002f;
+ gain1 = 0.0004f;
+ gain2 = 0.0004f;
pwm11.write(0.00f);
pwm12.write(0.00f);
@@ -150,12 +151,12 @@
case(7)://黒黒黒ゆっくり
dif1 = g - c1;
dif2 = g - c2;
- gain1 = 0.0004f;
- gain2 = 0.0004f;
+ gain1 = 0.0002f;
+ gain2 = 0.0002f;
- pwm11.write(0.45f + dif1*gain1);
+ pwm11.write(0.50f + dif1*gain1);
pwm12.write(0.30f);
- pwm21.write(0.45f + dif2*gain2);
+ pwm21.write(0.50f + dif2*gain2);
pwm22.write(0.30f);
break;