hallo
Dependencies: mbed
main.cpp@0:5664d8473933, 2016-05-25 (annotated)
- Committer:
- benjaminmoerth
- Date:
- Wed May 25 08:48:23 2016 +0000
- Revision:
- 0:5664d8473933
Geschwindigkeitseinstellung
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
benjaminmoerth | 0:5664d8473933 | 1 | #include "mbed.h" |
benjaminmoerth | 0:5664d8473933 | 2 | |
benjaminmoerth | 0:5664d8473933 | 3 | DigitalOut LedD1 (P1_10); |
benjaminmoerth | 0:5664d8473933 | 4 | DigitalOut LedD2 (P1_11); |
benjaminmoerth | 0:5664d8473933 | 5 | DigitalOut LedD4 (P1_12); |
benjaminmoerth | 0:5664d8473933 | 6 | DigitalOut LedD5 (P1_13); |
benjaminmoerth | 0:5664d8473933 | 7 | DigitalOut LedD6 (P1_14); |
benjaminmoerth | 0:5664d8473933 | 8 | DigitalOut LedD7 (P1_15); |
benjaminmoerth | 0:5664d8473933 | 9 | DigitalOut LedD8 (P1_16); |
benjaminmoerth | 0:5664d8473933 | 10 | DigitalOut LedD9 (P1_17); |
benjaminmoerth | 0:5664d8473933 | 11 | DigitalOut LedD10 (P1_18); |
benjaminmoerth | 0:5664d8473933 | 12 | DigitalOut LedD11 (P2_16); |
benjaminmoerth | 0:5664d8473933 | 13 | DigitalOut LedD12 (P1_20); |
benjaminmoerth | 0:5664d8473933 | 14 | DigitalOut LedD13 (P1_21); |
benjaminmoerth | 0:5664d8473933 | 15 | |
benjaminmoerth | 0:5664d8473933 | 16 | |
benjaminmoerth | 0:5664d8473933 | 17 | DigitalOut Von (P2_13); // Motor Spannung ab BERTL15 nötig ! |
benjaminmoerth | 0:5664d8473933 | 18 | |
benjaminmoerth | 0:5664d8473933 | 19 | PwmOut MotorL (P1_19); |
benjaminmoerth | 0:5664d8473933 | 20 | DigitalOut MotorL_EN(P1_19); // Enable OB DIE LINKS ODER RECHTS IST NOCH NICHT KLAR ! |
benjaminmoerth | 0:5664d8473933 | 21 | DigitalOut MotorL_FORWARD(P2_14); // Forwerts |
benjaminmoerth | 0:5664d8473933 | 22 | DigitalOut MotorL_REVERSE(P2_15); // Rückwerts |
benjaminmoerth | 0:5664d8473933 | 23 | |
benjaminmoerth | 0:5664d8473933 | 24 | PwmOut MotorR (P2_19); |
benjaminmoerth | 0:5664d8473933 | 25 | DigitalOut MotorR_EN(P2_19); //Die Leitung führt zum Pin PO_21 am Prozessor |
benjaminmoerth | 0:5664d8473933 | 26 | DigitalOut MotorR_FORWARD(P2_21); //Die Leitung führt zum Pin P1_3 am Prozessor |
benjaminmoerth | 0:5664d8473933 | 27 | DigitalOut MotorR_REVERSE(P2_20); |
benjaminmoerth | 0:5664d8473933 | 28 | |
benjaminmoerth | 0:5664d8473933 | 29 | int main() |
benjaminmoerth | 0:5664d8473933 | 30 | { |
benjaminmoerth | 0:5664d8473933 | 31 | Von=1; |
benjaminmoerth | 0:5664d8473933 | 32 | // Motor Spannung EIN |
benjaminmoerth | 0:5664d8473933 | 33 | |
benjaminmoerth | 0:5664d8473933 | 34 | |
benjaminmoerth | 0:5664d8473933 | 35 | |
benjaminmoerth | 0:5664d8473933 | 36 | MotorL_EN = 0.5f; |
benjaminmoerth | 0:5664d8473933 | 37 | |
benjaminmoerth | 0:5664d8473933 | 38 | |
benjaminmoerth | 0:5664d8473933 | 39 | MotorR_EN = 1.0f; |
benjaminmoerth | 0:5664d8473933 | 40 | |
benjaminmoerth | 0:5664d8473933 | 41 | |
benjaminmoerth | 0:5664d8473933 | 42 | |
benjaminmoerth | 0:5664d8473933 | 43 | // Beide Motoren ENABLE |
benjaminmoerth | 0:5664d8473933 | 44 | LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=1; |
benjaminmoerth | 0:5664d8473933 | 45 | MotorL_FORWARD = MotorR_FORWARD= 1; |
benjaminmoerth | 0:5664d8473933 | 46 | wait (1); |
benjaminmoerth | 0:5664d8473933 | 47 | MotorL_FORWARD = MotorR_FORWARD= 0; |
benjaminmoerth | 0:5664d8473933 | 48 | while(1) |
benjaminmoerth | 0:5664d8473933 | 49 | { |
benjaminmoerth | 0:5664d8473933 | 50 | LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=0; |
benjaminmoerth | 0:5664d8473933 | 51 | wait (1); |
benjaminmoerth | 0:5664d8473933 | 52 | LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=1; |
benjaminmoerth | 0:5664d8473933 | 53 | wait (1), |
benjaminmoerth | 0:5664d8473933 | 54 | LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=0; |
benjaminmoerth | 0:5664d8473933 | 55 | wait(1); |
benjaminmoerth | 0:5664d8473933 | 56 | LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=1; |
benjaminmoerth | 0:5664d8473933 | 57 | |
benjaminmoerth | 0:5664d8473933 | 58 | MotorL_REVERSE= MotorR_REVERSE= 1; |
benjaminmoerth | 0:5664d8473933 | 59 | wait(2); |
benjaminmoerth | 0:5664d8473933 | 60 | MotorL_REVERSE= MotorR_REVERSE= 0; |
benjaminmoerth | 0:5664d8473933 | 61 | |
benjaminmoerth | 0:5664d8473933 | 62 | LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=0; |
benjaminmoerth | 0:5664d8473933 | 63 | wait (1); |
benjaminmoerth | 0:5664d8473933 | 64 | LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=1; |
benjaminmoerth | 0:5664d8473933 | 65 | wait (1), |
benjaminmoerth | 0:5664d8473933 | 66 | LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=0; |
benjaminmoerth | 0:5664d8473933 | 67 | wait(1); |
benjaminmoerth | 0:5664d8473933 | 68 | LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=1; |
benjaminmoerth | 0:5664d8473933 | 69 | |
benjaminmoerth | 0:5664d8473933 | 70 | MotorL_FORWARD = MotorR_FORWARD= 1; |
benjaminmoerth | 0:5664d8473933 | 71 | wait (2); |
benjaminmoerth | 0:5664d8473933 | 72 | MotorL_FORWARD = MotorR_FORWARD= 0; |
benjaminmoerth | 0:5664d8473933 | 73 | |
benjaminmoerth | 0:5664d8473933 | 74 | |
benjaminmoerth | 0:5664d8473933 | 75 | |
benjaminmoerth | 0:5664d8473933 | 76 | |
benjaminmoerth | 0:5664d8473933 | 77 | } |
benjaminmoerth | 0:5664d8473933 | 78 | } |