![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Roboter
main.cpp
- Committer:
- itslinear
- Date:
- 2017-04-11
- Revision:
- 4:fdcf3b5009c6
- Parent:
- 3:24e098715b78
- Child:
- 5:f48b2609c328
File content as of revision 4:fdcf3b5009c6:
#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 Servo servos1(PB_7); Servo servos2(PA_6); //Periphery for limit switch DigitalIn limitSwitch1(PA_10); DigitalIn limitSwitch2(PB_13); //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, &limitSwitch1, &limitSwitch2); int main() { enable = 1; enableMotorDriver = 1; /*roboter1.kamera(); //Kameraauswertung while(cam=1) { roboter1.getBlock(); wait(0.1f); }*/ //while(cam==1 && camY>20) { //ausweichen aktive solange Y-Wert von Kamera grösser als 20 roboter1.bandeAusweichen(); wait(0.1f); //} //while(cam==0) { //im Kreis drehen bis Kamera einen Klotz sieht roboter1.findBlock(); wait(0.1f); //} }