TURN 180grd

Dependencies:   mbed

Fork of _B14_Lektion03d by BULME_BERTL14

main.cpp

Committer:
Enenkel
Date:
2015-03-20
Revision:
2:e7ac10c40c2a
Parent:
1:0ea49e814f60

File content as of revision 2:e7ac10c40c2a:

/***********************************
_B14_Lektion03b    TURN 180%
author: Gottfried Enenkel   HTL BULME
Date:   10.3.15
Aufgabe:
    Ändere die Software so, dass
    der Bertl 1m gerade fährt,
    dann eine 180° Drehung macht 
    dann wieder 1, zurück fährt
    usw usw
    -> Was passiert? Wie exakt fährt dein BERTL ?    
***********************************/
#include "mbed.h"

// ************ DEKLARATIONEN **************
DigitalOut MotorL_EN(P1_15);         
DigitalOut MotorL_FORWARD(P1_1);   
DigitalOut MotorL_REVERSE(P1_0);   

DigitalOut MotorR_EN(P0_21);     //Die Leitung führt zum Pin PO_21 am Prozessor
DigitalOut MotorR_FORWARD(P1_3); //Die Leitung führt zum Pin P1_3 am Prozessor
DigitalOut MotorR_REVERSE(P1_4);

// *************  Hauptprogramm ************
int main() {                 // Start Hauptprogramm
    MotorR_EN=MotorL_EN=1;   // Beide Motoren ENABLE
    while(1) {               // Anfang der Schleife (ohne Abbruch)   
        MotorR_FORWARD = MotorL_FORWARD = 1;  // Beide Motoren vorwärts EIN
        wait (1.0);          // warte 1 Sekunde  
        MotorR_FORWARD = MotorL_FORWARD = 0;  // Motoren AUS  
        wait (1.0);          // warte 1 Sekunde 
    }                        // Springe zum Anfang der Schleife 
}                            // Ende des Hauptprogrammes

// **************     ENDE     *************