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 _B15_T4_Motor by
main.cpp@2:416e90645a22, 2015-06-19 (annotated)
- Committer:
- Enenkel
- Date:
- Fri Jun 19 06:52:24 2015 +0000
- Revision:
- 2:416e90645a22
- Parent:
- 1:0f7c167a4f97
- Child:
- 3:8dab5659d872
B15 T4 MOTOR TEST
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Enenkel | 0:a8a0195ed7dc | 1 | /*********************************** |
Enenkel | 1:0f7c167a4f97 | 2 | name: BERTL_2015_MOTOR_TEST |
Enenkel | 1:0f7c167a4f97 | 3 | author: Gottfried Enenkel HTL BULME |
Enenkel | 1:0f7c167a4f97 | 4 | email: ene@bulme.at |
Enenkel | 0:a8a0195ed7dc | 5 | description: |
Enenkel | 1:0f7c167a4f97 | 6 | Der BERTL fährt 1 sec lang VORWÄRTS! |
Enenkel | 1:0f7c167a4f97 | 7 | Danach steht er für 1 sec |
Enenkel | 1:0f7c167a4f97 | 8 | |
Enenkel | 1:0f7c167a4f97 | 9 | Wenn der Motor richtig eingebaut ist, |
Enenkel | 1:0f7c167a4f97 | 10 | steht über dem Linken Anschluß ein PLUS |
Enenkel | 1:0f7c167a4f97 | 11 | Wenn sich der BERTL dreht, ist ein Motor verkehrt eingebaut. |
Enenkel | 0:a8a0195ed7dc | 12 | |
Enenkel | 1:0f7c167a4f97 | 13 | ***********************************/ |
Enenkel | 1:0f7c167a4f97 | 14 | #include "mbed.h" |
Enenkel | 1:0f7c167a4f97 | 15 | |
Enenkel | 1:0f7c167a4f97 | 16 | // ************ DEKLARATIONEN ************** |
Enenkel | 1:0f7c167a4f97 | 17 | DigitalOut Von (P1_2); // Motor Spannung ab BERTL15 nötig ! |
Enenkel | 1:0f7c167a4f97 | 18 | DigitalOut MotorL_EN(P1_15); // Enable |
Enenkel | 1:0f7c167a4f97 | 19 | DigitalOut MotorL_FORWARD(P1_1); // Forwerts |
Enenkel | 1:0f7c167a4f97 | 20 | DigitalOut MotorL_REVERSE(P1_0); // Rückwerts |
Enenkel | 1:0f7c167a4f97 | 21 | |
Enenkel | 1:0f7c167a4f97 | 22 | DigitalOut MotorR_EN(P0_21); //Die Leitung führt zum Pin PO_21 am Prozessor |
Enenkel | 1:0f7c167a4f97 | 23 | DigitalOut MotorR_FORWARD(P1_3); //Die Leitung führt zum Pin P1_3 am Prozessor |
Enenkel | 1:0f7c167a4f97 | 24 | DigitalOut MotorR_REVERSE(P1_4); |
Enenkel | 0:a8a0195ed7dc | 25 | |
Enenkel | 1:0f7c167a4f97 | 26 | // ************* Hauptprogramm ************ |
Enenkel | 1:0f7c167a4f97 | 27 | int main() { // Start Hauptprogramm |
Enenkel | 1:0f7c167a4f97 | 28 | Von=1; // Motor Spannung EIN |
Enenkel | 1:0f7c167a4f97 | 29 | MotorR_EN=MotorL_EN=1; // Beide Motoren ENABLE |
Enenkel | 1:0f7c167a4f97 | 30 | while(1) { // Anfang der Schleife (ohne Abbruch) |
Enenkel | 2:416e90645a22 | 31 | MotorR_FORWARD = 1; // RECHTER Motor vorwärts EIN |
Enenkel | 2:416e90645a22 | 32 | MotorL_FORWARD = 1; // LINKER Motoren vorwärts EIN |
Enenkel | 1:0f7c167a4f97 | 33 | wait (1.0); // warte 1 Sekunde |
Enenkel | 2:416e90645a22 | 34 | MotorR_FORWARD = 0; // RECHTER Motor STOP |
Enenkel | 2:416e90645a22 | 35 | MotorL_FORWARD = 0; // LINKER Motoren STOP |
Enenkel | 1:0f7c167a4f97 | 36 | wait (1.0); // warte 1 Sekunde |
Enenkel | 1:0f7c167a4f97 | 37 | } // Springe zum Anfang der Schleife |
Enenkel | 1:0f7c167a4f97 | 38 | } // Ende des Hauptprogrammes |
Enenkel | 1:0f7c167a4f97 | 39 | |
Enenkel | 1:0f7c167a4f97 | 40 | // ************** ENDE ************* |
Enenkel | 1:0f7c167a4f97 | 41 | |
Enenkel | 1:0f7c167a4f97 | 42 | |
Enenkel | 1:0f7c167a4f97 | 43 | |
Enenkel | 1:0f7c167a4f97 | 44 | |
Enenkel | 1:0f7c167a4f97 | 45 | |
Enenkel | 1:0f7c167a4f97 | 46 |