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
main.cpp
00001 /*********************************** 00002 name: BERTL_16_MOTOR_TEST 8.1.2016 00003 author: Gottfried Enenkel HTL BULME 00004 email: ene@bulme.at 00005 description: 00006 Der BERTL fährt 1 sec lang VORWÄRTS! 00007 Danach steht er für 1 sec 00008 00009 Wenn der Motor richtig eingebaut ist, 00010 steht über dem Linken Anschluß ein PLUS 00011 Wenn sich der BERTL dreht, ist ein Motor verkehrt eingebaut. 00012 00013 ***********************************/ 00014 #include "mbed.h" 00015 00016 // ************ DEKLARATIONEN ************** 00017 DigitalOut Von (P2_13); // Motor Spannung ab BERTL15 nötig ! 00018 DigitalOut MotorL_EN(P1_19); // Enable OB DIE LINKS ODER RECHTS IST NOCH NICHT KLAR ! 00019 DigitalOut MotorL_FORWARD(P2_15); // Forwerts 00020 DigitalOut MotorL_REVERSE(P2_14); // Rückwerts 00021 00022 DigitalOut MotorR_EN(P2_19); //Die Leitung führt zum Pin PO_21 am Prozessor 00023 DigitalOut MotorR_FORWARD(P2_20); //Die Leitung führt zum Pin P1_3 am Prozessor 00024 DigitalOut MotorR_REVERSE(P2_21); 00025 00026 00027 // ************* Hauptprogramm ************ 00028 int main() 00029 { 00030 DigitalOut LED1 (P1_10); 00031 DigitalOut LED2 (P1_11); 00032 DigitalOut LED3 (P1_12); 00033 DigitalOut LED4 (P1_12); 00034 DigitalOut LED5 (P1_13); 00035 DigitalOut LED6 (P1_14); 00036 DigitalOut LED7 (P1_15); 00037 DigitalOut LED8 (P1_16); 00038 DigitalOut LED9 (P1_17); 00039 DigitalOut LED10 (P1_18); 00040 DigitalOut LED11 (P2_16); 00041 DigitalOut LED12 (P1_20); 00042 DigitalOut LED13 (P1_21); 00043 DigitalOut LED20 (P1_5); 00044 DigitalOut LED24 (P1_5); 00045 DigitalOut LED25 (P1_6); 00046 DigitalOut TA1 (P1_23); 00047 Von=1; 00048 MotorR_EN=MotorL_EN=1; 00049 int a; 00050 a=0; 00051 while(a<4) { 00052 00053 00054 00055 00056 int b; 00057 //int c; 00058 int d; 00059 00060 LED1=LED2=LED4=LED5=LED6=LED7=LED8=LED9=LED10=LED11=LED12=LED13=LED20=LED24=1; 00061 LED1=LED4=0; 00062 LED20=LED24=0; 00063 MotorL_FORWARD = 1; 00064 MotorR_FORWARD = 1; 00065 00066 wait (7.0); 00067 00068 MotorL_FORWARD = 0; 00069 MotorR_FORWARD = 0; 00070 00071 LED1=LED4=1; 00072 LED7=LED9=0; 00073 b=0; 00074 while (b<2) { 00075 LED8=0; 00076 LED5=0; 00077 wait (0.5); 00078 LED5=1; 00079 LED8=1; 00080 wait (0.5); 00081 b=b++; 00082 } 00083 00084 00085 00086 MotorL_FORWARD =1; 00087 MotorR_REVERSE =1; 00088 wait (0.25); 00089 MotorL_FORWARD = 0; 00090 MotorR_REVERSE = 0; 00091 wait (2.0); 00092 LED7=LED9= 1; 00093 00094 LED1=LED4=0; 00095 MotorL_FORWARD=1; 00096 MotorR_FORWARD=1; 00097 wait (4.0); 00098 MotorL_FORWARD=0; 00099 MotorR_FORWARD=0; 00100 wait (0.0); 00101 LED1=LED4=1; 00102 00103 LED7=LED9=0; 00104 00105 d=0; 00106 while(d<2) { 00107 LED8=LED5=0; 00108 wait (0.5); 00109 LED8=LED5=1; 00110 wait (0.5); 00111 d=d++; 00112 } 00113 MotorL_FORWARD=1; 00114 MotorR_REVERSE=1; 00115 wait (0.25); 00116 MotorL_FORWARD=0; 00117 MotorR_REVERSE=0; 00118 wait (0.5); 00119 LED7=LED9=1; 00120 LED1=LED4=LED20=LED24=0; 00121 00122 00123 00124 00125 a=a++; 00126 00127 } 00128 } 00129 // ************** ENDE ************* 00130
Generated on Tue Sep 6 2022 19:16:12 by
1.7.2
