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 _B14_Lektion02c by
Revision 2:d70f3a0e2cd4, committed 2015-03-20
- Comitter:
- Enenkel
- Date:
- Fri Mar 20 09:59:40 2015 +0000
- Parent:
- 1:1b6e8646461b
- Commit message:
- Lauflicht BUS HEX
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Jan 25 17:26:42 2015 +0000
+++ b/main.cpp Fri Mar 20 09:59:40 2015 +0000
@@ -1,34 +1,37 @@
/***********************************
-name: BERTL_2014_TEST Lauflicht
+name: _B14_Lektion02c Lauflicht 1 LED via BUS
author: Gottfried Enenkel HTL BULME
-email: ene@bulme.at
-description:
- LEDS D10 - D13 blinken im sec Takt
-
-***********************************/
+date: 15.3.2015
+Aufgabe:
+ Lade die Software, führe sie aus.
+ Verändere die Software so, dass folgendes Lauflicht entsteht
+ D10 D11 D12 D13
+ - - - - Ein Durchgang dauert 3,5 sec
+ X - - - X=ON - = off
+ - X - -
+ - - X -
+ - - - X
+ - - - -
+ - - - X ab hier wieder zurück
+**********************************/
#include "mbed.h"
// ******* Definitionen ********
-DigitalOut ledD10(P1_8); //dem uP - Port 1 Pin 8 den Namen ledD10 zuweisen
-DigitalOut ledD11(P1_9);
-DigitalOut ledD12(P1_10);
-DigitalOut ledD13(P1_11);
+// Statt DigitalOut wird nun BusOut verwendet !
+BusOut leds(P1_8, P1_9, P1_10, P1_11); //LEDS als Bus definieren
// ******* Hauptroutine ********
-int main() { // Start Hauptprogramm
-ledD10 = ledD11 = ledD12 = ledD13 =0;
- while(1) { // Anfang der Schleife (ohne Abbruch)
- ledD10 = 1; // LED D10 einschalten
- wait(0.5); // warte 0.5 Sec.
- ledD10 = 0;
- ledD11 = 1;
+int main() { // 0x bedeutet eine HEX Zahl folgt (0-F)
+ while(1) { // Alle LED ein > 0xF; 8 4 2 1
+ leds = 0x0; // Alle LED aus 0x0; Alle LED EIN > 0xF;
+ wait(0.5); // 8 4 2 1 Wert
+ leds = 0x1; // 0 0 0 1;
+ wait(0.5);
+ leds = 0x3; // 0 0 1 1;
+ wait (0.5);
+ leds = 0x4; // 0 1 0 0;
wait(0.5);
- ledD11 = 0;
- ledD12 = 1;
- wait(0.5);
- ledD12 = 0;
- ledD13 = 1;
- wait (0.5); // warte 0.5 Sekunde
- ledD13 = 0;
+
+ // füge hier deine Software ein !
} // Springe zum Anfang der Schleife
} // Ende Hauptprogramm
// ******* Ende *********
