Josef Humer
/
BuNuc_1Hz_ticker
Ticker 1Hz, LED blink, basic, Interrupt
main.cpp@0:803e6b998f11, 2019-11-22 (annotated)
- Committer:
- heseg
- Date:
- Fri Nov 22 14:04:51 2019 +0000
- Revision:
- 0:803e6b998f11
Ticker, Interruptfunktion, LED Blink, nucleo F303, HESEG, CAMPUS02
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
heseg | 0:803e6b998f11 | 1 | /* ********************************************************** */ |
heseg | 0:803e6b998f11 | 2 | /* *************** Projekt: BuNuc_1Hz_Ticker **************** */ |
heseg | 0:803e6b998f11 | 3 | /* BULME Graz, Abteilung Elektronik und Technische Informatik */ |
heseg | 0:803e6b998f11 | 4 | /* ********************************************************** */ |
heseg | 0:803e6b998f11 | 5 | |
heseg | 0:803e6b998f11 | 6 | #include "mbed.h" // Library mbed |
heseg | 0:803e6b998f11 | 7 | |
heseg | 0:803e6b998f11 | 8 | Ticker flipper; // Def. der Tickerfunktion mit Namen flipper |
heseg | 0:803e6b998f11 | 9 | DigitalOut led1(D13); // LED am Port PB_3 |
heseg | 0:803e6b998f11 | 10 | |
heseg | 0:803e6b998f11 | 11 | /* **************** Interruptfunktion **************************** */ |
heseg | 0:803e6b998f11 | 12 | void flip() // Interruptfunktion flip() |
heseg | 0:803e6b998f11 | 13 | { |
heseg | 0:803e6b998f11 | 14 | led1 = !led1; // Logisches Invertieren des Spannungspegels |
heseg | 0:803e6b998f11 | 15 | } // end void |
heseg | 0:803e6b998f11 | 16 | |
heseg | 0:803e6b998f11 | 17 | /* ******************** Hauptprogramm **************************** */ |
heseg | 0:803e6b998f11 | 18 | int main() |
heseg | 0:803e6b998f11 | 19 | { |
heseg | 0:803e6b998f11 | 20 | led1 = 1; |
heseg | 0:803e6b998f11 | 21 | flipper.attach(&flip, 0.5); // Interruptaufruf alle 500 ms |
heseg | 0:803e6b998f11 | 22 | while(1); // Endlosschleife |
heseg | 0:803e6b998f11 | 23 | } // end main |