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.
Dependencies: mbed
Fork of Lektion02b_Kahr by
main.cpp
00001 #include "mbed.h" 00002 // HIMBED Lektion_02b "Lauflicht über 12 LED" 00003 // by Gottfried ENENKEL 2014-12-12 00004 // AUFGABE: 00005 // Verändere dis Software sie so, dass ein Lauflicht mit je 2 LED 00006 // über den 12 LED Balken des HIMBED entsteht 00007 // Das Lauflicht soll hin und her gleiten. 00008 // Am Anfang und am Ende sollen alle LED aus sein. 00009 // 00010 // DEFINITIONEN ************************************************* 00011 // Ausgange definieren: 00012 DigitalOut LedD1 (P1_8); 00013 DigitalOut LedD2 (P1_9); 00014 DigitalOut LedD3 (P1_10); 00015 DigitalOut LedD4 (P1_11); 00016 DigitalOut LedD13 (P1_0); //D13 geht auf EP10 und dieser auf Port0 Pin0 00017 DigitalOut LedD14 (P1_1); 00018 DigitalOut LedD15 (P1_3); 00019 DigitalOut LedD16 (P1_4); 00020 DigitalOut LedD17 (P1_6); 00021 DigitalOut LedD18 (P1_7); 00022 DigitalOut LedD19 (P1_12); 00023 DigitalOut LedD20 (P1_13); 00024 // hier ergänzen bis D20 00025 00026 // HAUPTPROGRAMM *********************************************** 00027 int main() 00028 { 00029 while(1) // Hauptschleife 00030 { 00031 LedD1=1; // LED D1 EIN 00032 wait(0.1); // warte 0.1 sec 00033 LedD2=1; // LED D2 EIN 00034 wait (0.1); // warte 0.1 sec 00035 LedD1=0; 00036 wait (0.1); 00037 LedD2=0; 00038 wait (0.1); 00039 00040 LedD3=1; 00041 wait (0.1); 00042 LedD4=1; 00043 wait (0.1); 00044 LedD3=0; 00045 wait (0.1); 00046 LedD4=0; 00047 wait (0.1); 00048 00049 LedD13=1; 00050 wait (0.1); 00051 LedD14=1; 00052 wait (0.1); 00053 LedD13=0; 00054 wait (0.1); 00055 LedD14=0; 00056 wait (0.1); 00057 00058 LedD15=1; 00059 wait (0.1); 00060 LedD16=1; 00061 wait (0.1); 00062 LedD15=0; 00063 wait (0.1); 00064 LedD16=0; 00065 wait (0.1); 00066 00067 LedD17=1; 00068 wait (0.1); 00069 LedD18=1; 00070 wait (0.1); 00071 LedD17=0; 00072 wait (0.1); 00073 LedD18=0; 00074 wait (0.1); 00075 00076 LedD19=1; 00077 wait (0.1); 00078 LedD20=1; 00079 wait (0.1); 00080 LedD19=0; 00081 wait (0.1); 00082 LedD20=0; 00083 wait (0.1); 00084 00085 LedD20=1; 00086 wait (0.1); 00087 LedD19=1; 00088 wait (0.1); 00089 LedD20=0; 00090 wait (0.1); 00091 LedD19=0; 00092 wait (0.1); 00093 00094 LedD18=1; 00095 wait (0.1); 00096 LedD17=1; 00097 wait (0.1); 00098 LedD18=0; 00099 wait (0.1); 00100 LedD17=0; 00101 wait (0.1); 00102 00103 LedD16=1; 00104 wait (0.1); 00105 LedD15=1; 00106 wait (0.1); 00107 LedD16=0; 00108 wait (0.1); 00109 LedD15=0; 00110 00111 LedD14=1; 00112 wait (0.1); 00113 LedD13=1; 00114 wait (0.1); 00115 LedD14=0; 00116 wait (0.1); 00117 LedD13=0; 00118 wait (0.1); 00119 00120 LedD4=1; 00121 wait (0.1); 00122 LedD3=1; 00123 wait (0.1); 00124 LedD4=0; 00125 wait (0.1); 00126 LedD3=0; 00127 wait (0.1); 00128 00129 LedD2=1; 00130 wait (0.1); 00131 LedD1=1; 00132 wait (0.1); 00133 LedD2=0; 00134 wait (0.1); 00135 LedD1=0; 00136 wait (0.1); 00137 00138 } 00139 } 00140 // ENDE ***************************************************** 00141 /* ++++++++++ ÜBUNGEN ++++++++++++ 00142 Erstelle eine Software, welche im 0.5 Sec Takt 00143 die in der jeweiligen Var. angegebenen Sequenzen abarbeitet. 00144 x = LED ON 00145 Var.1 Var.2 00146 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 00147 D1 x x x - - - - - - - - x - - - - - - - x x x - x 00148 D2 - x x x - - - - - - - x - - - - - - x x x - - x 00149 D3 - - x x x - - - - - - x - - - - - x x x - - - x 00150 D4 - - - x x x - - - - - x - - - - x x x - - - - x 00151 D13 - - - - x x x - - - - x - - - x x x - - - - - x 00152 D14 - - - - - x x x - - - x - - x x x - - - - - - x 00153 D15 - - - - - - x x x - - x - x x x - - - - - - - x 00154 D16 - - - - - - - x x x - x x x x - - - - - - - - x 00155 00156 Var.3 Var.4 00157 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 00158 D1 x x x x - - - - - - - - - - - - - - - x x x x - 00159 D2 - x x x x - - - - - - - - - - - - - x x x x - - 00160 D3 - - x x x x - - - - - - - - - - - x x x x - - - 00161 D4 - - - x x x x - - - - - - - - - x x x x - - - - 00162 D13 - - - x x x x x - - - - - - - x x x x - - - - - 00163 D14 - - - - x x x x x - - - - - x x x x - - - - - - 00164 D15 - - - - - x x x x x - - - x x x x - - - - - - - 00165 D16 - - - - - - x x x x x - x x x x - - - - - - - - 00166 00167 Var.5 Var.6 00168 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 00169 D1 x x x - - - - - - - x x x - - - - - - - - - - - 00170 D2 - x x x - - - - - x x - - x - - - - - - - - - - 00171 D3 - - x x x - - - x x - - - - x - - - - - - - - - 00172 D4 - - - x x x - x x - - - - - - x - - - - - - - x 00173 D13 - - - x x x - x x - - - - - - - x - - - - - x - 00174 D14 - - x x x - - - x x - - - - - - - x - - - x - - 00175 D15 - x x x - - - - - x x - - - - - - - x - x - - - 00176 D16 x x x - - - - - - - x x - - - - - - - x - - - - 00177 00178 00179 Var.7 Var.8 00180 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 00181 D1 x - - - - - x - - - x - - - - x - x - x - - - x 00182 D2 x - - - - - x - - - x - - - - x - x - x - - - x 00183 D3 - x - - - x - x - - x - - - x - - x - - x - - x 00184 D4 - x - - - x - x - - x - - - x - - x - - x - - x 00185 D13 - - x - x - - - x - x - - x - - - x - - - x - x 00186 D14 - - x - x - - - x - x - - x - - - x - - - x - - x 00187 D15 - - - x - - - - - x x - x - - - - x - - - - x - x 00188 D16 - - - x - - - - - x x - x - - - - x - - - - x - x 00189 00190 ********************** ENDE ***********************************/
Generated on Sun Jul 31 2022 04:39:07 by
1.7.2
