![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Roboter
main.cpp@1:4e84271a70c6, 2017-04-04 (annotated)
- Committer:
- itslinear
- Date:
- Tue Apr 04 11:55:54 2017 +0000
- Revision:
- 1:4e84271a70c6
- Parent:
- 0:306a2438de17
- Child:
- 2:953263712480
fds
Who changed what in which revision?
User | Revision | Line number | New 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 | |
itslinear | 0:306a2438de17 | 17 | //motor stuff |
itslinear | 0:306a2438de17 | 18 | DigitalOut enableMotorDriver(PB_2); |
itslinear | 0:306a2438de17 | 19 | |
itslinear | 0:306a2438de17 | 20 | //indicator leds arround robot |
itslinear | 0:306a2438de17 | 21 | DigitalOut leds[] = { PC_8, PC_6, PB_12, PA_7, PC_0, PC_9 }; |
itslinear | 0:306a2438de17 | 22 | |
itslinear | 1:4e84271a70c6 | 23 | Roboter roboter1(&distance, &bit0, &bit1, &bit2, &pwmL, &pwmR); |
itslinear | 0:306a2438de17 | 24 | |
itslinear | 1:4e84271a70c6 | 25 | int main() |
itslinear | 1:4e84271a70c6 | 26 | { |
itslinear | 1:4e84271a70c6 | 27 | enable = 1; |
itslinear | 1:4e84271a70c6 | 28 | enableMotorDriver = 1; |
itslinear | 1:4e84271a70c6 | 29 | |
itslinear | 1:4e84271a70c6 | 30 | while(1) { |
itslinear | 1:4e84271a70c6 | 31 | |
itslinear | 1:4e84271a70c6 | 32 | roboter1.bandeAusweichen(); |
itslinear | 1:4e84271a70c6 | 33 | // roboter.readSensor1(); |
itslinear | 1:4e84271a70c6 | 34 | |
itslinear | 1:4e84271a70c6 | 35 | wait(0.1f); |
itslinear | 1:4e84271a70c6 | 36 | |
itslinear | 1:4e84271a70c6 | 37 | } |
itslinear | 1:4e84271a70c6 | 38 | } |