Daniel Kahr
Dependencies: mbed
Fork of Lektion02b_Kahr by
main.cpp
- Committer:
- Enenkel
- Date:
- 2016-01-06
- Revision:
- 2:46da9f6bc48c
- Parent:
- 1:52e206dbe635
- Child:
- 3:6acee5d90cd0
File content as of revision 2:46da9f6bc48c:
#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 (guckst du in Schalplan! //DigitalOut LedD4 (gucktst du nochmals in Schaltplan! DigitalOut LedD13 (P1_0); //D13 geht auf EP10 und dieser auf Port0 Pin0 DigitalOut LedD14 (P1_1); // hier ergänzen bis D20 // HAUPTPROGRAMM *********************************************** int main() { while(1) // Hauptschleife { LedD1=1; // LED D1 EIN wait(0.4); // warte 0.4 sec LedD2=1; // LED D2 EIN wait (0.4); // warte 0.4 sec LedD1=0; wait (0.4); LedD2 = 0; // schreibe hier deine Software! // sinnvoll hier weiter schreiben! LedD13=1; wait (0.4); LedD14=1; wait (0.4); LedD13=0; wait (0.4); LedD14=0; wait (0.4); } } // 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 ***********************************/