Lauflicht über 4 LED (BusOut; wait)
Dependencies: mbed
Fork of _B14_Lektion02c by
main.cpp
- Committer:
- Enenkel
- Date:
- 2017-05-13
- Revision:
- 3:f63f8af9a3cb
- Parent:
- 2:d70f3a0e2cd4
File content as of revision 3:f63f8af9a3cb:
/***************************************************************************** name: B17_Lektion02c Lauflicht 1 LED via BUS author: Gottfried Enenkel HTL BULME date: 15.5.2017 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 ******** // Statt DigitalOut wird nun BusOut verwendet ! BusOut leds(P1_8, P1_9, P1_10, P1_11); //LEDS als Bus definieren // ******* Hauptroutine ******** int main() // 0x bedeutet eine HEX Zahl folgt (0-F) { while(1) { // Alle LED ein > 0xF; 8+4+2+1=15=F leds = 0x0; // Alle LED aus 0x0; wait(0.5); // 8 4 2 1 Wert leds = 0x1; // 0 0 0 1; 0x8+0+4+0x2+1+1=dec 1 = hex 1 wait(0.5); leds = 0x3; // 0 0 1 1; wait (0.5); leds = 0x4; // 0 1 0 0; wait(0.5); // füge hier deine Software ein ! leds=(0xF); // 1 1 1 1, Alle LEDS ON = dec15 =hec F } // Springe zum Anfang der Schleife } // Ende Hauptprogramm // ******* Ende *********