Quadrat fahren

Dependencies:   mbed

Committer:
simonmacher
Date:
Tue May 02 10:50:15 2017 +0000
Revision:
0:7ec47c516da5
Bertl17 Lektion 11;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simonmacher 0:7ec47c516da5 1 #include "mbed.h"
simonmacher 0:7ec47c516da5 2
simonmacher 0:7ec47c516da5 3 // ************ DEKLARATIONEN **************
simonmacher 0:7ec47c516da5 4 DigitalOut Von (P2_13); // Motor Spannung ab BERTL15 nötig !
simonmacher 0:7ec47c516da5 5 DigitalOut MotorL_EN(P1_19); // Enable OB DIE LINKS ODER RECHTS IST NOCH NICHT KLAR !
simonmacher 0:7ec47c516da5 6 DigitalOut MotorL_FORWARD(P2_14); // Forwerts
simonmacher 0:7ec47c516da5 7 DigitalOut MotorL_REVERSE(P2_15); // Rückwerts
simonmacher 0:7ec47c516da5 8
simonmacher 0:7ec47c516da5 9 DigitalOut MotorR_EN(P2_19); //Die Leitung führt zum Pin PO_21 am Prozessor
simonmacher 0:7ec47c516da5 10 DigitalOut MotorR_FORWARD(P2_21); //Die Leitung führt zum Pin P1_3 am Prozessor
simonmacher 0:7ec47c516da5 11 DigitalOut MotorR_REVERSE(P2_20);
simonmacher 0:7ec47c516da5 12
simonmacher 0:7ec47c516da5 13 // ************* Hauptprogramm ************
simonmacher 0:7ec47c516da5 14 int main() { // Start Hauptprogramm
simonmacher 0:7ec47c516da5 15 Von=1; // Motor Spannung EIN
simonmacher 0:7ec47c516da5 16 MotorR_EN=MotorL_EN=1; // Beide Motoren ENABLE
simonmacher 0:7ec47c516da5 17
simonmacher 0:7ec47c516da5 18 while(1)
simonmacher 0:7ec47c516da5 19 {
simonmacher 0:7ec47c516da5 20 MotorR_FORWARD = 1;
simonmacher 0:7ec47c516da5 21 MotorL_FORWARD = 1;
simonmacher 0:7ec47c516da5 22 wait (1.0);
simonmacher 0:7ec47c516da5 23 MotorR_FORWARD = 0;
simonmacher 0:7ec47c516da5 24 MotorR_FORWARD = 1;
simonmacher 0:7ec47c516da5 25 wait(1.0);
simonmacher 0:7ec47c516da5 26 MotorR_FORWARD = 1;
simonmacher 0:7ec47c516da5 27 MotorL_FORWARD = 1;
simonmacher 0:7ec47c516da5 28 wait (1.0);
simonmacher 0:7ec47c516da5 29 MotorR_FORWARD = 0;
simonmacher 0:7ec47c516da5 30 MotorR_FORWARD = 1;
simonmacher 0:7ec47c516da5 31 MotorR_FORWARD = 1;
simonmacher 0:7ec47c516da5 32 MotorL_FORWARD = 1;
simonmacher 0:7ec47c516da5 33 wait (1.0);
simonmacher 0:7ec47c516da5 34 MotorR_FORWARD = 0;
simonmacher 0:7ec47c516da5 35 MotorR_FORWARD = 1;
simonmacher 0:7ec47c516da5 36 wait(1.0);
simonmacher 0:7ec47c516da5 37 MotorR_FORWARD = 1;
simonmacher 0:7ec47c516da5 38 MotorL_FORWARD = 1;
simonmacher 0:7ec47c516da5 39 wait (1.0);
simonmacher 0:7ec47c516da5 40 MotorR_FORWARD = 0;
simonmacher 0:7ec47c516da5 41 MotorR_FORWARD = 1;
simonmacher 0:7ec47c516da5 42 }
simonmacher 0:7ec47c516da5 43 }