Christian Lukas
/
motorfahrt
This is a programm of fun, you could say it is a show
Revision 0:28e3f0945e35, committed 2016-06-08
- Comitter:
- chipsian
- Date:
- Wed Jun 08 11:25:58 2016 +0000
- Commit message:
- This is a programm for fun, you could say it's a show
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 28e3f0945e35 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jun 08 11:25:58 2016 +0000 @@ -0,0 +1,144 @@ +/*********************************** +name: BERTL_16_MOTOR_TEST 8.1.2016 +author: Gottfried Enenkel HTL BULME +email: ene@bulme.at +description: + Der BERTL fährt 1 sec lang VORWÄRTS! + Danach steht er für 1 sec + + Wenn der Motor richtig eingebaut ist, + steht über dem Linken Anschluß ein PLUS + 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 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 _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); + +// ************* Hauptprogramm ************ +int main() + +{ + _LED1 = 1; + wait(0.1); _LED1 = 0; + + _LED2 = 1; + wait(0.1); _LED2 = 0; + + _LED3 = 1; + wait(0.1); _LED3 = 0; + + _LED4 = 1; + wait(0.1); _LED4 = 0; + + _LED5 = 1; + wait(0.1); _LED5 = 0; + + _LED6 = 1; + wait(0.1); _LED6 = 0; + + _LED7 = 1; + wait(0.1); _LED7 = 0; + + _LED8 = 1; + wait(0.1); _LED8 = 0; + + _LED9 = 1; + wait(0.1); _LED9 = 0; + + _LED10 = 1; + wait(0.1); _LED10 = 0; + + _LED11 = 1; + wait(0.1); _LED11 = 0; + + _LED12 = 1; + wait(0.1); _LED12 = 0; + + _LED20 = 1; + wait(0.1); _LED20 = 0; + + _LED24 = 1; + wait(0.1); _LED24 = 0; + + _LED25 = 1; + wait(0.1); _LED25 = 0; + + TA1 = 1; + wait(0.1); TA1 = 0; + + + + + Von=1; + MotorR_EN=MotorL_EN=1; +{ // 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_REVERSE = 1; // LINKER Motoren vorwärts EIN + wait (3.0) ; // warte 5 sekunden + + MotorR_FORWARD = 0; + MotorL_REVERSE = 1; + wait (2.0); + + MotorL_REVERSE = 0; + MotorR_FORWARD = 1; + MotorL_FORWARD = 1; + wait (1.0); + + MotorR_FORWARD = 0; + MotorL_FORWARD = 0; + MotorR_REVERSE = 1; + MotorL_REVERSE = 1; + wait(2.0); + + MotorL_REVERSE = 0; + MotorR_REVERSE = 1; + MotorL_FORWARD = 1; + wait(1.0); + + + MotorL_FORWARD = 0; + MotorR_REVERSE = 1; + MotorL_FORWARD = 0; + wait (0.1); + + MotorR_REVERSE = 0; + MotorL_FORWARD = 1; + wait(2.0); + + + + } // Springe zum Anfang der Schleife +} // Ende des Hauptprogrammes + +}
diff -r 000000000000 -r 28e3f0945e35 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jun 08 11:25:58 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file