![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
xx
Fork of PES1 by
main.cpp
- Committer:
- itslinear
- Date:
- 2017-04-04
- Revision:
- 3:24e098715b78
- Parent:
- 2:953263712480
- Child:
- 4:fdcf3b5009c6
File content as of revision 3:24e098715b78:
#include <mbed.h> #include "Roboter.h" DigitalOut led(LED1); //Periphery for distance sensors AnalogIn distance(PB_1); DigitalOut enable(PC_1); DigitalOut bit0(PH_1); DigitalOut bit1(PC_2); DigitalOut bit2(PC_3); IRSensor sensors[6]; // 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 }; Roboter roboter1(&distance, &bit0, &bit1, &bit2, &pwmL, &pwmR, &servos1,&servos2); int main() { enable = 1; enableMotorDriver = 1; while(1) { 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); } }