![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
hallo
Fork of PES1 by
Diff: readCamera.cpp
- Revision:
- 19:adae367247d4
- Parent:
- 18:3ee1b02ed3aa
- Child:
- 20:a90e5b54bf7b
--- a/readCamera.cpp Tue May 09 15:25:54 2017 +0000 +++ b/readCamera.cpp Fri May 12 12:25:34 2017 +0000 @@ -6,14 +6,14 @@ static int i = 0; static int k = 0; static float distance = 0; // für dynamische Geschwindigkeit -static float yLimit = 165; // Punkt an dem Roboter anhalten soll +static float yLimit = 155; // Punkt an dem Roboter anhalten soll int j; uint16_t blocks; - float state; -int readCamera() -{ +int readCamera(int now) +{ + state = now; pixy.setSerialOutput(&pc); blocks = pixy.getBlocks(1); @@ -44,17 +44,17 @@ if(yAxis > yLimit) { - if (xAxis < 145) { // links fahren + if (xAxis < 140) { // links fahren state = 100; - } else if (xAxis > 175) { // rechts fahren + } else if (xAxis > 180) { // rechts fahren state = 200; } else { // Klotz bereit zum Aufnehmen state = 400; } } - if(yAxis <= 30) { // Zone mit vielen Fehlern + if(yAxis <= 20) { // Zone mit vielen Fehlern state = 0; // deshalb wird alles, was dort drin ist als "kein Klotz in Sichtweite"" gewertet } } @@ -62,8 +62,7 @@ } } else { k++; - if (k % 20 == 0) { - i=0; + if (k % 5 == 0) { k = 0; state = 0; // kein Klotz in Sichtweite }