Nikola Cvetković
/
19E042PIM_V1_BM_BUTTON
Program for NUCLEO-L476RG which uses mbed.h to demonstrate USER BUTTON usage (19E042PIM).
main.cpp@0:2338470bb540, 2021-10-11 (annotated)
- Committer:
- tzwell
- Date:
- Mon Oct 11 17:57:55 2021 +0000
- Revision:
- 0:2338470bb540
- Child:
- 1:8d38990190c1
First commit, first publish;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tzwell | 0:2338470bb540 | 1 | /* |
tzwell | 0:2338470bb540 | 2 | * Primer pritiska tastera za STM32L476RG |
tzwell | 0:2338470bb540 | 3 | * napisan koristeci mbed.h biblioteku. |
tzwell | 0:2338470bb540 | 4 | * |
tzwell | 0:2338470bb540 | 5 | * Katedra za Elektroniku i digitalne sisteme |
tzwell | 0:2338470bb540 | 6 | * Elektrotehnicki fakultet |
tzwell | 0:2338470bb540 | 7 | * Beograd |
tzwell | 0:2338470bb540 | 8 | * |
tzwell | 0:2338470bb540 | 9 | * Oktobar 2021. |
tzwell | 0:2338470bb540 | 10 | * |
tzwell | 0:2338470bb540 | 11 | */ |
tzwell | 0:2338470bb540 | 12 | |
tzwell | 0:2338470bb540 | 13 | /* |
tzwell | 0:2338470bb540 | 14 | * Biblioteke za uvoz: |
tzwell | 0:2338470bb540 | 15 | */ |
tzwell | 0:2338470bb540 | 16 | #include "mbed.h" |
tzwell | 0:2338470bb540 | 17 | |
tzwell | 0:2338470bb540 | 18 | /* |
tzwell | 0:2338470bb540 | 19 | * Definisanje makroa: |
tzwell | 0:2338470bb540 | 20 | */ |
tzwell | 0:2338470bb540 | 21 | #define PERIOD_POLIRANJA 50 |
tzwell | 0:2338470bb540 | 22 | /* |
tzwell | 0:2338470bb540 | 23 | * Globalne promenljive: |
tzwell | 0:2338470bb540 | 24 | */ |
tzwell | 0:2338470bb540 | 25 | DigitalOut DiodicaNaPloci (LED1); // Kreiranje promenljive diode |
tzwell | 0:2338470bb540 | 26 | DigitalIn TasterNaPloci (BUTTON1); // Kreiranje promenljive tastera |
tzwell | 0:2338470bb540 | 27 | /* |
tzwell | 0:2338470bb540 | 28 | * Deklaracija funkcija: |
tzwell | 0:2338470bb540 | 29 | */ |
tzwell | 0:2338470bb540 | 30 | |
tzwell | 0:2338470bb540 | 31 | /* |
tzwell | 0:2338470bb540 | 32 | * Glavna funkcija: |
tzwell | 0:2338470bb540 | 33 | */ |
tzwell | 0:2338470bb540 | 34 | int main() |
tzwell | 0:2338470bb540 | 35 | { |
tzwell | 0:2338470bb540 | 36 | // Glavna petlja: |
tzwell | 0:2338470bb540 | 37 | while(true) |
tzwell | 0:2338470bb540 | 38 | { |
tzwell | 0:2338470bb540 | 39 | DiodicaNaPloci = !TasterNaPloci;// Dioda preuzima vrednost tastera |
tzwell | 0:2338470bb540 | 40 | wait_ms(PERIOD_POLIRANJA); // Program ceka neki period poliranja |
tzwell | 0:2338470bb540 | 41 | } |
tzwell | 0:2338470bb540 | 42 | } |
tzwell | 0:2338470bb540 | 43 | |
tzwell | 0:2338470bb540 | 44 | /* |
tzwell | 0:2338470bb540 | 45 | * Definicija funkcija: |
tzwell | 0:2338470bb540 | 46 | */ |