Roboter

Dependencies:   Servo pixy mbed

Committer:
schneju2
Date:
Tue Apr 04 13:22:24 2017 +0000
Revision:
2:953263712480
Parent:
1:4e84271a70c6
Child:
3:24e098715b78
mit servos

Who changed what in which revision?

UserRevisionLine numberNew contents of line
itslinear 0:306a2438de17 1 #include <mbed.h>
itslinear 0:306a2438de17 2 #include "Roboter.h"
itslinear 0:306a2438de17 3
itslinear 0:306a2438de17 4 DigitalOut led(LED1);
itslinear 0:306a2438de17 5
itslinear 0:306a2438de17 6 //Periphery for distance sensors
itslinear 1:4e84271a70c6 7 AnalogIn distance(PB_1);
itslinear 0:306a2438de17 8 DigitalOut enable(PC_1);
itslinear 0:306a2438de17 9 DigitalOut bit0(PH_1);
itslinear 0:306a2438de17 10 DigitalOut bit1(PC_2);
itslinear 0:306a2438de17 11 DigitalOut bit2(PC_3);
itslinear 0:306a2438de17 12 IRSensor sensors[6];
itslinear 0:306a2438de17 13
itslinear 1:4e84271a70c6 14 PwmOut pwmL( PA_8 );
itslinear 1:4e84271a70c6 15 PwmOut pwmR( PA_9 );
itslinear 1:4e84271a70c6 16
schneju2 2:953263712480 17 // Periphery for servos
schneju2 2:953263712480 18 Servos servos1(PB_7);
schneju2 2:953263712480 19 Servos servos2(PA_6);
schneju2 2:953263712480 20
itslinear 0:306a2438de17 21 //motor stuff
itslinear 0:306a2438de17 22 DigitalOut enableMotorDriver(PB_2);
itslinear 0:306a2438de17 23
itslinear 0:306a2438de17 24 //indicator leds arround robot
itslinear 0:306a2438de17 25 DigitalOut leds[] = { PC_8, PC_6, PB_12, PA_7, PC_0, PC_9 };
itslinear 0:306a2438de17 26
schneju2 2:953263712480 27 Roboter roboter1(&distance, &bit0, &bit1, &bit2, &pwmL, &pwmR, &servos1,&servos2);
itslinear 0:306a2438de17 28
itslinear 1:4e84271a70c6 29 int main()
itslinear 1:4e84271a70c6 30 {
itslinear 1:4e84271a70c6 31 enable = 1;
itslinear 1:4e84271a70c6 32 enableMotorDriver = 1;
itslinear 1:4e84271a70c6 33
itslinear 1:4e84271a70c6 34 while(1) {
itslinear 1:4e84271a70c6 35
itslinear 1:4e84271a70c6 36 roboter1.bandeAusweichen();
itslinear 1:4e84271a70c6 37 // roboter.readSensor1();
itslinear 1:4e84271a70c6 38
itslinear 1:4e84271a70c6 39 wait(0.1f);
itslinear 1:4e84271a70c6 40
itslinear 1:4e84271a70c6 41 }
itslinear 1:4e84271a70c6 42 }
schneju2 2:953263712480 43