Daniel Kahr
Dependencies: mbed
Fork of M0_Lektion02b 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.4); // warte 0.4 sec 00033 LedD2=1; // LED D2 EIN 00034 wait (0.4); // warte 0.4 sec 00035 LedD1=0; 00036 wait (0.4); 00037 LedD2=0; 00038 wait (0.4); 00039 LedD3=1; 00040 wait (0.4); 00041 LedD4=1; 00042 wait (0.4); 00043 LedD3=0; 00044 wait (0.4); 00045 LedD4=0; 00046 wait (0.4); 00047 LedD13=1; 00048 wait (0.4); 00049 LedD14=1; 00050 wait (0.4); 00051 LedD13=0; 00052 wait (0.4); 00053 LedD14=0; 00054 wait (0.4); 00055 LedD15=1; 00056 wait (0.4); 00057 LedD16=1; 00058 wait (0.4); 00059 LedD15=0; 00060 wait (0.4); 00061 LedD16=0; 00062 wait (0.4); 00063 LedD17=1; 00064 wait (0.4); 00065 LedD18=1; 00066 wait (0.4); 00067 LedD17=0; 00068 wait (0.4); 00069 LedD18=0; 00070 wait (0.4); 00071 LedD19=1; 00072 wait (0.4); 00073 LedD20=1; 00074 wait (0.4); 00075 LedD19=0; 00076 wait (0.4); 00077 LedD20=0; 00078 00079 00080 00081 00082 wait (0.4); 00083 00084 00085 } 00086 } 00087 // ENDE ***************************************************** 00088 /* ++++++++++ ÜBUNGEN ++++++++++++ 00089 Erstelle eine Software, welche im 0.5 Sec Takt 00090 die in der jeweiligen Var. angegebenen Sequenzen abarbeitet. 00091 x = LED ON 00092 Var.1 Var.2 00093 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 00094 D1 x x x - - - - - - - - x - - - - - - - x x x - x 00095 D2 - x x x - - - - - - - x - - - - - - x x x - - x 00096 D3 - - x x x - - - - - - x - - - - - x x x - - - x 00097 D4 - - - x x x - - - - - x - - - - x x x - - - - x 00098 D13 - - - - x x x - - - - x - - - x x x - - - - - x 00099 D14 - - - - - x x x - - - x - - x x x - - - - - - x 00100 D15 - - - - - - x x x - - x - x x x - - - - - - - x 00101 D16 - - - - - - - x x x - x x x x - - - - - - - - x 00102 00103 Var.3 Var.4 00104 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 00105 D1 x x x x - - - - - - - - - - - - - - - x x x x - 00106 D2 - x x x x - - - - - - - - - - - - - x x x x - - 00107 D3 - - x x x x - - - - - - - - - - - x x x x - - - 00108 D4 - - - x x x x - - - - - - - - - x x x x - - - - 00109 D13 - - - x x x x x - - - - - - - x x x x - - - - - 00110 D14 - - - - x x x x x - - - - - x x x x - - - - - - 00111 D15 - - - - - x x x x x - - - x x x x - - - - - - - 00112 D16 - - - - - - x x x x x - x x x x - - - - - - - - 00113 00114 Var.5 Var.6 00115 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 00116 D1 x x x - - - - - - - x x x - - - - - - - - - - - 00117 D2 - x x x - - - - - x x - - x - - - - - - - - - - 00118 D3 - - x x x - - - x x - - - - x - - - - - - - - - 00119 D4 - - - x x x - x x - - - - - - x - - - - - - - x 00120 D13 - - - x x x - x x - - - - - - - x - - - - - x - 00121 D14 - - x x x - - - x x - - - - - - - x - - - x - - 00122 D15 - x x x - - - - - x x - - - - - - - x - x - - - 00123 D16 x x x - - - - - - - x x - - - - - - - x - - - - 00124 00125 00126 Var.7 Var.8 00127 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 00128 D1 x - - - - - x - - - x - - - - x - x - x - - - x 00129 D2 x - - - - - x - - - x - - - - x - x - x - - - x 00130 D3 - x - - - x - x - - x - - - x - - x - - x - - x 00131 D4 - x - - - x - x - - x - - - x - - x - - x - - x 00132 D13 - - x - x - - - x - x - - x - - - x - - - x - x 00133 D14 - - x - x - - - x - x - - x - - - x - - - x - - x 00134 D15 - - - x - - - - - x x - x - - - - x - - - - x - x 00135 D16 - - - x - - - - - x x - x - - - - x - - - - x - x 00136 00137 ********************** ENDE ***********************************/
Generated on Thu Jul 21 2022 01:31:53 by
1.7.2
BULME_AHEL20
