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.
Fork of PES by
Revision 21:d05dee0d1a7d, committed 2017-05-01
- Comitter:
- Shukle
- Date:
- Mon May 01 09:47:45 2017 +0000
- Parent:
- 20:c961dc550882
- Child:
- 22:ffd36f07c046
- Commit message:
- zusammengef?gt neues main und neue readcamera
Changed in this revision
| readCamera.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/readCamera.cpp Mon May 01 09:42:51 2017 +0000
+++ b/readCamera.cpp Mon May 01 09:47:45 2017 +0000
@@ -8,6 +8,8 @@
static int k = 0;
static int range = 1; // 1: fährt strahl an, 2: fährt kegel an
static int state = 0;
+static double distance = 0;
+static int yLimit = 155;
int j;
uint16_t blocks;
@@ -29,17 +31,23 @@
// soll drehen bis in stahl, fahren bis kegel, 25 pixel links rechts kegel
- if(xAxis < 185 && xAxis > 135 && yAxis > 155 && yAxis < 190 ) { // wenn Klotz an Position zum aufnehmen
- state = 4;
+ if(xAxis < 180 && xAxis > 140 && yAxis > 155 && yAxis < yLimit ) { // wenn Klotz an Position zum aufnehmen
+ state = 400;
range = 1;
} else {
if (range == 1){ // fährt Strahl an
- if (xAxis < 155){
- state = 1;
- } else if (xAxis > 165){
- state = 2;
+ if (xAxis < 140){
+ distance = ((xAxis - 160)*(-0.625))-1;
+ state = 100 + (int) distance;
+ } else if (xAxis > 180){
+ distance = ((xAxis - 160)*(0.625))-1;
+ state = 200 + (int) distance;
} else{ // fährt gerade
- state = 3;
+ distance = (((yAxis - yLimit)/(199-yLimit))*100);
+ state = 300 + (int) distance;
+ if (state == 400){
+ state=399;
+ }
range = 2;
}
} else { // fährt solange bis Kegelrand
@@ -63,6 +71,6 @@
}
//printf("%d\n\r",state);
//printf("%d, %d\n\r", xAxis, yAxis);
- return state;
+ return (double) state;
}
}
\ No newline at end of file
