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 12:8ae6609a66bf, committed 2016-10-28
- Comitter:
- csellier
- Date:
- Fri Oct 28 09:10:58 2016 +0000
- Parent:
- 11:055ee1a3cb75
- Child:
- 13:bdb92f041eca
- Commit message:
- updated 28th october, almost completed, need to add servo commands to line following
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Oct 21 10:30:20 2016 +0000 +++ b/main.cpp Fri Oct 28 09:10:58 2016 +0000 @@ -2,7 +2,8 @@ #include "Servo.h" #define DISTANCE 0.45 -#define VBORDER 0.5 //VBORDER being the LDR voltage value when going from the black line to the white surface and vice versa +#define VBORDER1 0.7 //VBORDER being the LDR voltage value when going from the black line to the white surface and vice versa, assume >0.7 is white surfce +#define VBORDER2 0.3 // assume black surface <0.3 @@ -112,15 +113,15 @@ } else if (front < DISTANCE) { //follow line - if (LDRvalueright < VBORDER && LDRvalueleft > VBORDER){ + if (LDRvalueright < VBORDER2 && LDRvalueleft > VBORDER1){ //ldr right is in the black and ldr left is in the white then turn right // turn right } - if (LDRvalueright > VBORDER && LDRvalueleft < VBORDER){ + if (LDRvalueright > VBORDER1 && LDRvalueleft < VBORDER2){ //ldr right is in the white and ldr left is in the black //turn left } - if LDRvalueright = VBORDER && LDRvalueright = VBORDER) { + if LDRvalueright < VBORDER2 && LDRvalueleft < VBORDER2) { //both ldr right and ldr left are in the black, continue ahead //go straight }