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.
Diff: main.cpp
- Revision:
- 3:bc6c111b88da
- Parent:
- 2:bbd10b5da0bf
- Child:
- 4:b81dc4282175
--- a/main.cpp Mon Oct 22 08:35:25 2018 +0000
+++ b/main.cpp Fri Oct 26 16:54:54 2018 +0000
@@ -17,24 +17,24 @@
BusOut Mrighti(PTC0, PTC7);
PwmOut Mrightp(PTA12);
-float white = 0.5, black = 0.08, gray = 0.15; //値をぶち込む
+float white = 0.6, black = 0.08, gray = 0.3; //値をぶち込む
float whiteR = 0.02, blackR = 0.008, grayR = 0.015; //弱いセンサ用
float sensor[4]; //sensor[0]:sensorL ... sensor[3]:sensorR
void turn_right(){
Mlefti = 2;
- Mleftp = 0.5f;
+ Mleftp = 0.7f;
Mrighti = 1;
- Mrightp = 0.5f;
+ Mrightp = 0.7f;
ledR = 1;
ledL = 0;
}
void turn_left(){
Mrighti = 2;
- Mrightp = 0.5f;
+ Mrightp = 1.0f;
Mlefti = 1;
- Mleftp = 0.3f;
+ Mleftp = 0.5f;
ledR = 0;
ledL = 1;
}
@@ -42,9 +42,9 @@
void go_straight(){
//まっすぐ行こう
Mrighti = 2;
- Mrightp = 0.8f;
+ Mrightp = 1.0f;
Mlefti = 2;
- Mleftp = 0.8f;
+ Mleftp = 0.7f;
ledR = 0;
ledL = 0;
}
@@ -68,11 +68,11 @@
if( sensor[1] >= white && sensor[2] <= gray)
turn_right();
- else if( sensor[1] <= gray && sensor[2] >= white)
+ else if( sensor[1] <= black && sensor[2] >= white)
turn_left();
else
go_straight();
- if( sensor[0] <= gray && sensor[3] <= grayR){
+ if( sensor[0] <= black && sensor[3] <= blackR){
stop_point();
break;
}