Lauflicht mit HEXA - Zahlen

Dependencies:   mbed

Committer:
Leonard_Haghofer
Date:
Tue May 02 09:20:35 2017 +0000
Revision:
0:ae5b417143b2
Lauflicht Vor und Zur?ck.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Leonard_Haghofer 0:ae5b417143b2 1 #include "mbed.h"
Leonard_Haghofer 0:ae5b417143b2 2 // HIMBED Lektion_04 "Lauflicht 8LED via BUS"
Leonard_Haghofer 0:ae5b417143b2 3 //
Leonard_Haghofer 0:ae5b417143b2 4 // AUFGABE:
Leonard_Haghofer 0:ae5b417143b2 5 // Die LED D20 bis D13 werden als BUS definiert.
Leonard_Haghofer 0:ae5b417143b2 6 // 8 Leitungen -> =2x4 leitungen -> 00 bis FF
Leonard_Haghofer 0:ae5b417143b2 7 // 2 LED soll hin und her laufen
Leonard_Haghofer 0:ae5b417143b2 8 // Am Anfang und am Ende darf kein LED leuchten !
Leonard_Haghofer 0:ae5b417143b2 9 // bei LED 20 beginnen !
Leonard_Haghofer 0:ae5b417143b2 10 // DEFINITIONEN *************************************************
Leonard_Haghofer 0:ae5b417143b2 11 // Bus Definition
Leonard_Haghofer 0:ae5b417143b2 12 // LED D20 geht auf EP113 und weiter auf P0_13
Leonard_Haghofer 0:ae5b417143b2 13 // BusOut led(*,*,*,*,*); BUS mit LEDs definiern.
Leonard_Haghofer 0:ae5b417143b2 14 // LSB * Bus ergänzen! * MSB
Leonard_Haghofer 0:ae5b417143b2 15
Leonard_Haghofer 0:ae5b417143b2 16 // HAUPTPROGRAMM ***********************************************
Leonard_Haghofer 0:ae5b417143b2 17 /*
Leonard_Haghofer 0:ae5b417143b2 18 int main()
Leonard_Haghofer 0:ae5b417143b2 19 {
Leonard_Haghofer 0:ae5b417143b2 20 led=0xFF; // Alle 8 LED EIN
Leonard_Haghofer 0:ae5b417143b2 21 wait(1); // warte 1 sec.
Leonard_Haghofer 0:ae5b417143b2 22 while(1) // Hauptschleife
Leonard_Haghofer 0:ae5b417143b2 23 {
Leonard_Haghofer 0:ae5b417143b2 24 led=0x00; //LED 0000 0000 Hex 00
Leonard_Haghofer 0:ae5b417143b2 25 wait(0.2);
Leonard_Haghofer 0:ae5b417143b2 26 led=0x01; //LED 0000 0001 Hex 01
Leonard_Haghofer 0:ae5b417143b2 27 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 28 led=0x03;
Leonard_Haghofer 0:ae5b417143b2 29 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 30 led=0x06;
Leonard_Haghofer 0:ae5b417143b2 31 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 32 led=0x0C;
Leonard_Haghofer 0:ae5b417143b2 33 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 34 led=0x18;
Leonard_Haghofer 0:ae5b417143b2 35 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 36 led=0x30;
Leonard_Haghofer 0:ae5b417143b2 37 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 38 led=0x60;
Leonard_Haghofer 0:ae5b417143b2 39 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 40 led=0xC0;
Leonard_Haghofer 0:ae5b417143b2 41 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 42 led=0x80;
Leonard_Haghofer 0:ae5b417143b2 43 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 44 led=0x00;
Leonard_Haghofer 0:ae5b417143b2 45 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 46 led=0x80;
Leonard_Haghofer 0:ae5b417143b2 47 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 48 led=0xC0;
Leonard_Haghofer 0:ae5b417143b2 49 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 50 led=0x60;
Leonard_Haghofer 0:ae5b417143b2 51 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 52 led=0x30;
Leonard_Haghofer 0:ae5b417143b2 53 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 54 led=0x18;
Leonard_Haghofer 0:ae5b417143b2 55 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 56 led=0x0C;
Leonard_Haghofer 0:ae5b417143b2 57 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 58 led=0x06;
Leonard_Haghofer 0:ae5b417143b2 59 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 60 led=0x03;
Leonard_Haghofer 0:ae5b417143b2 61 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 62 led=0x01;
Leonard_Haghofer 0:ae5b417143b2 63 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 64 led=0x00;
Leonard_Haghofer 0:ae5b417143b2 65 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 66
Leonard_Haghofer 0:ae5b417143b2 67 //LED 0000 0011 Hex 03
Leonard_Haghofer 0:ae5b417143b2 68 // Ergänze selber in HEX!
Leonard_Haghofer 0:ae5b417143b2 69
Leonard_Haghofer 0:ae5b417143b2 70
Leonard_Haghofer 0:ae5b417143b2 71 led=0xFF; //LED 0000 0110
Leonard_Haghofer 0:ae5b417143b2 72 wait (0.2);
Leonard_Haghofer 0:ae5b417143b2 73 //LED 0000 1100
Leonard_Haghofer 0:ae5b417143b2 74 //LED 0001 1000
Leonard_Haghofer 0:ae5b417143b2 75 // usw
Leonard_Haghofer 0:ae5b417143b2 76 // dann läuft der Balken wieder zurück!
Leonard_Haghofer 0:ae5b417143b2 77
Leonard_Haghofer 0:ae5b417143b2 78 }
Leonard_Haghofer 0:ae5b417143b2 79 }
Leonard_Haghofer 0:ae5b417143b2 80 // ENDE *****************************************************
Leonard_Haghofer 0:ae5b417143b2 81
Leonard_Haghofer 0:ae5b417143b2 82 */