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 43:9f541718be01, committed 2015-03-10
- Comitter:
- mperella
- Date:
- Tue Mar 10 16:57:23 2015 +0000
- Parent:
- 42:c189b914931d
- Commit message:
- think the linescan stuff might be right
Changed in this revision
newAlgorithm.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/newAlgorithm.cpp Tue Mar 10 15:51:02 2015 +0000 +++ b/newAlgorithm.cpp Tue Mar 10 16:57:23 2015 +0000 @@ -113,14 +113,17 @@ if (TFC_LineScanImageReady !=0) { // first image - position = getSensorValues(image); // get position + if(CurrentLineScanChannel) + { + position = getSensorValues(true); // get position + } + // second image + else + { + position = getSensorValues(false); + } error = pid_calc(position); // send position to PID algorithm to get error calcMotors(error); // send error to calculate both motors - - // second image - position = getSensorValues(image); - error = pid_calc(position); - calcMotors(error); } } else @@ -135,26 +138,23 @@ { for (uint16_t i=0; i<128; i++) { - if ((*(TFC_LineScanImage1+i) < 250)) + if ((*(TFC_LineScanImage0+i) < 250)) { black_values_list[black_value_count] = i; black_value_count++; } } - - image = false; } else { for (uint16_t i=0; i<128; i++) { - if ((*(TFC_LineScanImage0+i) < 250)) + if ((*(TFC_LineScanImage1+i) < 250)) { black_values_list[black_value_count] = i; black_value_count++; } } - image = true; } for(int i=0; i<black_value_count; i++)