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 M0_Lektion02b by
Revision 3:51957e6c8ab4, committed 2016-04-21
- Comitter:
- StefanSeebacher
- Date:
- Thu Apr 21 07:47:32 2016 +0000
- Parent:
- 2:46da9f6bc48c
- Commit message:
- M0_?bung_2b
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Jan 06 12:40:59 2016 +0000
+++ b/main.cpp Thu Apr 21 07:47:32 2016 +0000
@@ -1,101 +1,106 @@
#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:
+
+// **** DEFINITIONEN ****
+
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 LedD3 (P1_10);
+DigitalOut LedD4 (P1_11);
+DigitalOut LedD13 (P1_0);
DigitalOut LedD14 (P1_1);
- // hier ergänzen bis D20
+DigitalOut LedD15 (P1_3);
+DigitalOut LedD16 (P1_4);
+DigitalOut LedD17 (P1_6);
+DigitalOut LedD18 (P1_7);
+DigitalOut LedD19 (P1_12);
+DigitalOut LedD20 (P1_13);
-// HAUPTPROGRAMM ***********************************************
+ // **** HAUPTPROGRAMM ****
+
int main()
{
- while(1) // Hauptschleife
+ while(1)
{
- 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=1;
+ wait(0.4);
+ LedD2=1;
+ wait (0.4);
LedD1=0;
-
+ LedD3=1;
wait (0.4);
- LedD2 = 0;
-
- // schreibe hier deine Software!
- // sinnvoll hier weiter schreiben!
+ LedD2=0;
+ LedD4=1;
+ wait (0.4);
+ LedD3=0;
LedD13=1;
wait (0.4);
+ LedD4=0;
LedD14=1;
wait (0.4);
LedD13=0;
+ LedD15=1;
wait (0.4);
LedD14=0;
-
-
+ LedD16=1;
+ wait (0.4);
+ LedD15=0;
+ LedD17=1;
+ wait (0.4);
+ LedD16=0;
+ LedD18=1;
+ wait (0.4);
+ LedD17=0;
+ LedD19=1;
+ wait (0.4);
+ LedD18=0;
+ LedD20=1;
+ wait (0.4);
+ LedD19=0;
+ wait (0.4);
+ LedD20=0;
+ wait (0.4);
+
+ //Zurück
+ LedD20=1;
wait (0.4);
-
+ LedD19=1;
+ wait (0.4);
+ LedD20=0;
+ LedD18=1;
+ wait (0.4);
+ LedD19=0;
+ LedD17=1;
+ wait (0.4);
+ LedD18=0;
+ LedD16=1;
+ wait (0.4);
+ LedD17=0;
+ LedD15=1;
+ wait (0.4);
+ LedD16=0;
+ LedD14=1;
+ wait (0.4);
+ LedD15=0;
+ LedD13=1;
+ wait (0.4);
+ LedD14=0;
+ LedD4=1;
+ wait (0.4);
+ LedD13=0;
+ LedD3=1;
+ wait (0.4);
+ LedD4=0;
+ LedD2=1;
+ wait (0.4);
+ LedD3=0;
+ LedD1=1;
+ wait (0.4);
+ LedD2=0;
+ wait (0.4);
+ LedD1=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 ***********************************/
\ No newline at end of file
+// **** ENDE ****
\ No newline at end of file
