Josef Humer
/
BuNuc_4bitCounter
4bit (LED) Counter, Busdefinition, NUCLEO, F303K8
main.cpp@0:f012a81fc5d2, 2019-11-22 (annotated)
- Committer:
- heseg
- Date:
- Fri Nov 22 14:09:13 2019 +0000
- Revision:
- 0:f012a81fc5d2
Nucleo F303K8, 4 bit Counter, Busdefinition, HESEG,
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
heseg | 0:f012a81fc5d2 | 1 | /* ********************************************************** */ |
heseg | 0:f012a81fc5d2 | 2 | /* *************** Projekt: BuNuc_4bitCounter *************** */ |
heseg | 0:f012a81fc5d2 | 3 | /* BULME Graz, Abteilung Elektronik und Technische Informatik */ |
heseg | 0:f012a81fc5d2 | 4 | /* ********************************************************** */ |
heseg | 0:f012a81fc5d2 | 5 | |
heseg | 0:f012a81fc5d2 | 6 | #include "mbed.h" |
heseg | 0:f012a81fc5d2 | 7 | BusOut myleds(D2, D3, D6, D9); // Definition der 4 LEDs als Bus |
heseg | 0:f012a81fc5d2 | 8 | /* ******* nucleo F303K8 Board, Erweiterung WOLF, BULME ***** */ |
heseg | 0:f012a81fc5d2 | 9 | |
heseg | 0:f012a81fc5d2 | 10 | /* ****************** Variablendefinition ***************************** */ |
heseg | 0:f012a81fc5d2 | 11 | short i=0; |
heseg | 0:f012a81fc5d2 | 12 | /* ********************* Hauptprogramm ******************************** */ |
heseg | 0:f012a81fc5d2 | 13 | main() |
heseg | 0:f012a81fc5d2 | 14 | { |
heseg | 0:f012a81fc5d2 | 15 | myleds=0; // Zählerstand auf 0 setzen |
heseg | 0:f012a81fc5d2 | 16 | while(1) // Endlosschleife |
heseg | 0:f012a81fc5d2 | 17 | { |
heseg | 0:f012a81fc5d2 | 18 | wait(0.5); // warte 500 msec |
heseg | 0:f012a81fc5d2 | 19 | myleds = i; |
heseg | 0:f012a81fc5d2 | 20 | i++; // Variablenwert um 1 erhöhen |
heseg | 0:f012a81fc5d2 | 21 | if(i==16) i=0; // Wenn i=16, dann Rücksetzen |
heseg | 0:f012a81fc5d2 | 22 | } // end while |
heseg | 0:f012a81fc5d2 | 23 | } |