Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BertlKurven by
Revision 4:2bf2ab6a1163, committed 2016-05-13
- Comitter:
- PatrickMarterer
- Date:
- Fri May 13 13:17:34 2016 +0000
- Parent:
- 3:acd2b6fdcd7f
- Commit message:
- Bertl f?hrt 4*2 Kurven und bleibt dann stehen + LED's aus
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Apr 21 12:17:28 2016 +0000 +++ b/main.cpp Fri May 13 13:17:34 2016 +0000 @@ -3,44 +3,128 @@ author: Gottfried Enenkel HTL BULME email: ene@bulme.at description: - Der BERTL fährt 1 sec lang VORWÄRTS! + Der BERTL fährt 1 sec lang VORWÄRTS! Danach steht er für 1 sec - - Wenn der Motor richtig eingebaut ist, + + Wenn der Motor richtig eingebaut ist, steht über dem Linken Anschluß ein PLUS - Wenn sich der BERTL dreht, ist ein Motor verkehrt eingebaut. - + Wenn sich der BERTL dreht, ist ein Motor verkehrt eingebaut. + ***********************************/ #include "mbed.h" // ************ DEKLARATIONEN ************** DigitalOut Von (P2_13); // Motor Spannung ab BERTL15 nötig ! -DigitalOut MotorL_EN(P1_19); // Enable OB DIE LINKS ODER RECHTS IST NOCH NICHT KLAR ! -DigitalOut MotorL_FORWARD(P2_14); // Forwerts -DigitalOut MotorL_REVERSE(P2_15); // Rückwerts +DigitalOut MotorL_EN(P1_19); // Enable OB DIE LINKS ODER RECHTS IST NOCH NICHT KLAR ! +DigitalOut MotorL_FORWARD(P2_15); // Forwerts +DigitalOut MotorL_REVERSE(P2_14); // Rückwerts DigitalOut MotorR_EN(P2_19); //Die Leitung führt zum Pin PO_21 am Prozessor -DigitalOut MotorR_FORWARD(P2_21); //Die Leitung führt zum Pin P1_3 am Prozessor -DigitalOut MotorR_REVERSE(P2_20); +DigitalOut MotorR_FORWARD(P2_20); //Die Leitung führt zum Pin P1_3 am Prozessor +DigitalOut MotorR_REVERSE(P2_21); + // ************* Hauptprogramm ************ -int main() { // Start Hauptprogramm - Von=1; // Motor Spannung EIN - MotorR_EN=MotorL_EN=1; // Beide Motoren ENABLE - while(1) { // Anfang der Schleife (ohne Abbruch) - MotorR_FORWARD = 1; // RECHTER Motor vorwärts EIN - MotorL_FORWARD = 1; // LINKER Motoren vorwärts EIN - wait (1.0); // warte 1 Sekunde - MotorR_FORWARD = 0; // RECHTER Motor STOP - MotorL_FORWARD = 0; // LINKER Motoren STOP - wait (1.0); // warte 1 Sekunde - } // Springe zum Anfang der Schleife -} // Ende des Hauptprogrammes +int main() +{ + DigitalOut LED1 (P1_10); + DigitalOut LED2 (P1_11); + DigitalOut LED3 (P1_12); + DigitalOut LED4 (P1_12); + DigitalOut LED5 (P1_13); + DigitalOut LED6 (P1_14); + DigitalOut LED7 (P1_15); + DigitalOut LED8 (P1_16); + DigitalOut LED9 (P1_17); + DigitalOut LED10 (P1_18); + DigitalOut LED11 (P2_16); + DigitalOut LED12 (P1_20); + DigitalOut LED13 (P1_21); + DigitalOut LED20 (P1_5); + DigitalOut LED24 (P1_5); + DigitalOut LED25 (P1_6); + DigitalOut TA1 (P1_23); + Von=1; + MotorR_EN=MotorL_EN=1; + int a; + a=0; + while(a<4) { + + + + + int b; + //int c; + int d; + + LED1=LED2=LED4=LED5=LED6=LED7=LED8=LED9=LED10=LED11=LED12=LED13=LED20=LED24=1; + LED1=LED4=0; + LED20=LED24=0; + MotorL_FORWARD = 1; + MotorR_FORWARD = 1; + + wait (7.0); + + MotorL_FORWARD = 0; + MotorR_FORWARD = 0; -// ************** ENDE ************* + LED1=LED4=1; + LED7=LED9=0; + b=0; + while (b<2) { + LED8=0; + LED5=0; + wait (0.5); + LED5=1; + LED8=1; + wait (0.5); + b=b++; + } + + + + MotorL_FORWARD =1; + MotorR_REVERSE =1; + wait (0.25); + MotorL_FORWARD = 0; + MotorR_REVERSE = 0; + wait (2.0); + LED7=LED9= 1; + + LED1=LED4=0; + MotorL_FORWARD=1; + MotorR_FORWARD=1; + wait (4.0); + MotorL_FORWARD=0; + MotorR_FORWARD=0; + wait (0.0); + LED1=LED4=1; + + LED7=LED9=0; + + d=0; + while(d<2) { + LED8=LED5=0; + wait (0.5); + LED8=LED5=1; + wait (0.5); + d=d++; + } + MotorL_FORWARD=1; + MotorR_REVERSE=1; + wait (0.25); + MotorL_FORWARD=0; + MotorR_REVERSE=0; + wait (0.5); + LED7=LED9=1; + LED1=LED4=LED20=LED24=0; + a=a++; + } +} +// ************** ENDE *************