![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Roboter
Diff: main.cpp
- Revision:
- 3:24e098715b78
- Parent:
- 2:953263712480
- Child:
- 4:fdcf3b5009c6
diff -r 953263712480 -r 24e098715b78 main.cpp --- a/main.cpp Tue Apr 04 13:22:24 2017 +0000 +++ b/main.cpp Tue Apr 04 13:27:59 2017 +0000 @@ -11,15 +11,14 @@ DigitalOut bit2(PC_3); IRSensor sensors[6]; -PwmOut pwmL( PA_8 ); -PwmOut pwmR( PA_9 ); - // Periphery for servos Servos servos1(PB_7); Servos servos2(PA_6); //motor stuff DigitalOut enableMotorDriver(PB_2); +PwmOut pwmL( PA_8 ); +PwmOut pwmR( PA_9 ); //indicator leds arround robot DigitalOut leds[] = { PC_8, PC_6, PB_12, PA_7, PC_0, PC_9 }; @@ -33,9 +32,20 @@ while(1) { - roboter1.bandeAusweichen(); - // roboter.readSensor1(); - + roboter1.kamera(); //Kameraauswertung + + roboter1.getBlock + + while(camY>20) { //ausweichen aktive solange Y-Wert von Kamera grösser als 20 + roboter1.bandeAusweichen(); + } + + while(cam==0) { //im Kreis drehen bis Kamera einen Klotz sieht + if( + roboter1.turn(); + } + + wait(0.1f); }