Daniel Kahr
Dependencies: mbed
Fork of Lektion02b_Kahr by
main.cpp
- Committer:
- DanielKahr
- Date:
- 2016-01-29
- Revision:
- 4:25f04078bca4
- Parent:
- 3:6acee5d90cd0
File content as of revision 4:25f04078bca4:
#include "mbed.h" // HIMBED Lektion_02b "Lauflicht über 12 LED" // by Gottfried ENENKEL 2014-12-12 // AUFGABE: // Verändere dis Software sie so, dass ein Lauflicht mit je 2 LED // über den 12 LED Balken des HIMBED entsteht // Das Lauflicht soll hin und her gleiten. // Am Anfang und am Ende sollen alle LED aus sein. // // DEFINITIONEN ************************************************* // Ausgange definieren: DigitalOut LedD1 (P1_8); DigitalOut LedD2 (P1_9); DigitalOut LedD3 (P1_10); DigitalOut LedD4 (P1_11); DigitalOut LedD13 (P1_0); //D13 geht auf EP10 und dieser auf Port0 Pin0 DigitalOut LedD14 (P1_1); DigitalOut LedD15 (P1_3); DigitalOut LedD16 (P1_4); DigitalOut LedD17 (P1_6); DigitalOut LedD18 (P1_7); DigitalOut LedD19 (P1_12); DigitalOut LedD20 (P1_13); // hier ergänzen bis D20 // HAUPTPROGRAMM *********************************************** int main() { while(1) // Hauptschleife { LedD1=1; // LED D1 EIN wait(0.1); // warte 0.1 sec LedD2=1; // LED D2 EIN wait (0.1); // warte 0.1 sec LedD1=0; wait (0.1); LedD2=0; wait (0.1); LedD3=1; wait (0.1); LedD4=1; wait (0.1); LedD3=0; wait (0.1); LedD4=0; wait (0.1); LedD13=1; wait (0.1); LedD14=1; wait (0.1); LedD13=0; wait (0.1); LedD14=0; wait (0.1); LedD15=1; wait (0.1); LedD16=1; wait (0.1); LedD15=0; wait (0.1); LedD16=0; wait (0.1); LedD17=1; wait (0.1); LedD18=1; wait (0.1); LedD17=0; wait (0.1); LedD18=0; wait (0.1); LedD19=1; wait (0.1); LedD20=1; wait (0.1); LedD19=0; wait (0.1); LedD20=0; wait (0.1); LedD20=1; wait (0.1); LedD19=1; wait (0.1); LedD20=0; wait (0.1); LedD19=0; wait (0.1); LedD18=1; wait (0.1); LedD17=1; wait (0.1); LedD18=0; wait (0.1); LedD17=0; wait (0.1); LedD16=1; wait (0.1); LedD15=1; wait (0.1); LedD16=0; wait (0.1); LedD15=0; LedD14=1; wait (0.1); LedD13=1; wait (0.1); LedD14=0; wait (0.1); LedD13=0; wait (0.1); LedD4=1; wait (0.1); LedD3=1; wait (0.1); LedD4=0; wait (0.1); LedD3=0; wait (0.1); LedD2=1; wait (0.1); LedD1=1; wait (0.1); LedD2=0; wait (0.1); LedD1=0; wait (0.1); } } // ENDE ***************************************************** /* ++++++++++ ÜBUNGEN ++++++++++++ Erstelle eine Software, welche im 0.5 Sec Takt die in der jeweiligen Var. angegebenen Sequenzen abarbeitet. x = LED ON Var.1 Var.2 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 D1 x x x - - - - - - - - x - - - - - - - x x x - x D2 - x x x - - - - - - - x - - - - - - x x x - - x D3 - - x x x - - - - - - x - - - - - x x x - - - x D4 - - - x x x - - - - - x - - - - x x x - - - - x D13 - - - - x x x - - - - x - - - x x x - - - - - x D14 - - - - - x x x - - - x - - x x x - - - - - - x D15 - - - - - - x x x - - x - x x x - - - - - - - x D16 - - - - - - - x x x - x x x x - - - - - - - - x Var.3 Var.4 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 D1 x x x x - - - - - - - - - - - - - - - x x x x - D2 - x x x x - - - - - - - - - - - - - x x x x - - D3 - - x x x x - - - - - - - - - - - x x x x - - - D4 - - - x x x x - - - - - - - - - x x x x - - - - D13 - - - x x x x x - - - - - - - x x x x - - - - - D14 - - - - x x x x x - - - - - x x x x - - - - - - D15 - - - - - x x x x x - - - x x x x - - - - - - - D16 - - - - - - x x x x x - x x x x - - - - - - - - Var.5 Var.6 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 D1 x x x - - - - - - - x x x - - - - - - - - - - - D2 - x x x - - - - - x x - - x - - - - - - - - - - D3 - - x x x - - - x x - - - - x - - - - - - - - - D4 - - - x x x - x x - - - - - - x - - - - - - - x D13 - - - x x x - x x - - - - - - - x - - - - - x - D14 - - x x x - - - x x - - - - - - - x - - - x - - D15 - x x x - - - - - x x - - - - - - - x - x - - - D16 x x x - - - - - - - x x - - - - - - - x - - - - Var.7 Var.8 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 D1 x - - - - - x - - - x - - - - x - x - x - - - x D2 x - - - - - x - - - x - - - - x - x - x - - - x D3 - x - - - x - x - - x - - - x - - x - - x - - x D4 - x - - - x - x - - x - - - x - - x - - x - - x D13 - - x - x - - - x - x - - x - - - x - - - x - x D14 - - x - x - - - x - x - - x - - - x - - - x - - x D15 - - - x - - - - - x x - x - - - - x - - - - x - x D16 - - - x - - - - - x x - x - - - - x - - - - x - x ********************** ENDE ***********************************/