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:
- 25:1d0f586aaf0c
- Parent:
- 24:504a58daa06e
- Child:
- 27:3dd1460365d3
- Child:
- 31:0c2b49175036
--- a/main.cpp Mon Mar 02 20:21:40 2015 +0000
+++ b/main.cpp Tue Mar 03 18:16:34 2015 +0000
@@ -1,6 +1,12 @@
//#include "mbed.h"
#include "TFC.h"
+#define AGGRESSIVE .55
+#define MODERATE .48
+#define CONSERVATIVE .35
+#define STOP 0
+#define BLACK_THRESHOLD 64
+
DigitalOut myled(LED1);
int main()
@@ -82,25 +88,25 @@
// checking behavior level
violence_level = int(TFC_GetDIP_Switch());
- if (violence_level==2) {
- current_left_motor_speed = -.48;
- current_right_motor_speed = .48;
+ if (violence_level==3) {
+ current_left_motor_speed = -(AGGRESSIVE);
+ current_right_motor_speed = AGGRESSIVE;
}
- if (violence_level==3) {
- current_left_motor_speed = -.55;
- current_right_motor_speed = .55;
+ if (violence_level==2) {
+ current_left_motor_speed = -(MODERATE);
+ current_right_motor_speed = (MODERATE);
}
else if (violence_level==1) {
- current_left_motor_speed = -.35;
- current_right_motor_speed = .35;
+ current_left_motor_speed = -(CONSERVATIVE);
+ current_right_motor_speed = CONSERVATIVE;
}
else if (violence_level==0) {
- current_left_motor_speed = 0;
- current_right_motor_speed = 0;
+ current_left_motor_speed = STOP;
+ current_right_motor_speed = STOP;
}
else {
- current_left_motor_speed = 0;
- current_right_motor_speed = 0;
+ current_left_motor_speed = STOP;
+ current_right_motor_speed = STOP;
}
@@ -211,7 +217,7 @@
}
// need to turn right
- if (black_center_value > 64) {
+ if (black_center_value > BLACK_THRESHOLD) {
current_servo_position= float(.01875*black_center_value-(1.2));
if( current_servo_position >= +0.4)
@@ -253,7 +259,7 @@
linescan_ping_pong = true;
}
- TFC_LineScanImageReady ==0; // since we used it, we reset the flag
+ TFC_LineScanImageReady = 0; // since we used it, we reset the flag
}// end imageready
}// end linescan stuff
}