Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@1:4372b6147382, 2021-10-28 (annotated)
- Committer:
- tzwell
- Date:
- Thu Oct 28 11:02:36 2021 +0000
- Revision:
- 1:4372b6147382
- Parent:
- 0:4d143c75068e
Updated comments and code structure
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| tzwell | 0:4d143c75068e | 1 | /* |
| tzwell | 0:4d143c75068e | 2 | * Primer PWM-a za STM32L476RG napisan |
| tzwell | 0:4d143c75068e | 3 | * koristeci mbed.h biblioteku. |
| tzwell | 0:4d143c75068e | 4 | * |
| tzwell | 0:4d143c75068e | 5 | * Katedra za Elektroniku i digitalne sisteme |
| tzwell | 0:4d143c75068e | 6 | * Elektrotehnicki fakultet |
| tzwell | 0:4d143c75068e | 7 | * Beograd |
| tzwell | 0:4d143c75068e | 8 | * |
| tzwell | 0:4d143c75068e | 9 | * Oktobar 2021. |
| tzwell | 0:4d143c75068e | 10 | * |
| tzwell | 0:4d143c75068e | 11 | */ |
| tzwell | 0:4d143c75068e | 12 | /* |
| tzwell | 0:4d143c75068e | 13 | * Biblioteke za uvoz: |
| tzwell | 0:4d143c75068e | 14 | */ |
| tzwell | 0:4d143c75068e | 15 | #include "mbed.h" |
| tzwell | 0:4d143c75068e | 16 | |
| tzwell | 0:4d143c75068e | 17 | /* |
| tzwell | 0:4d143c75068e | 18 | * Definisanje makroa: |
| tzwell | 0:4d143c75068e | 19 | */ |
| tzwell | 0:4d143c75068e | 20 | #define LED_ON 1 |
| tzwell | 0:4d143c75068e | 21 | #define LED_OFF 0 |
| tzwell | 0:4d143c75068e | 22 | #define LED_ON_TIME 250 |
| tzwell | 0:4d143c75068e | 23 | #define LED_OFF_TIME 750 |
| tzwell | 0:4d143c75068e | 24 | |
| tzwell | 0:4d143c75068e | 25 | /* |
| tzwell | 0:4d143c75068e | 26 | * Globalne promenljive: |
| tzwell | 0:4d143c75068e | 27 | */ |
| tzwell | 0:4d143c75068e | 28 | DigitalOut DiodicaNaPloci (LED1); // Kreiranje promenljive diode |
| tzwell | 0:4d143c75068e | 29 | |
| tzwell | 0:4d143c75068e | 30 | /* |
| tzwell | 0:4d143c75068e | 31 | * Deklaracija funkcija: |
| tzwell | 0:4d143c75068e | 32 | */ |
| tzwell | 0:4d143c75068e | 33 | |
| tzwell | 0:4d143c75068e | 34 | /* |
| tzwell | 0:4d143c75068e | 35 | * Glavna funkcija: |
| tzwell | 0:4d143c75068e | 36 | */ |
| tzwell | 0:4d143c75068e | 37 | int main() |
| tzwell | 0:4d143c75068e | 38 | { |
| tzwell | 1:4372b6147382 | 39 | // Inicijalizacija i funckije koje se jednom izvrsavaju: |
| tzwell | 0:4d143c75068e | 40 | |
| tzwell | 0:4d143c75068e | 41 | // Glavna petlja: |
| tzwell | 0:4d143c75068e | 42 | while(true) |
| tzwell | 0:4d143c75068e | 43 | { |
| tzwell | 0:4d143c75068e | 44 | DiodicaNaPloci = LED_ON; // Dioda se ukljuci |
| tzwell | 0:4d143c75068e | 45 | wait_ms(LED_ON_TIME); // Ostane ukljucena odredjeno vreme |
| tzwell | 0:4d143c75068e | 46 | DiodicaNaPloci = LED_OFF; // Dioda se iskljuci |
| tzwell | 0:4d143c75068e | 47 | wait_ms(LED_OFF_TIME); // Ostane iskljucena odredjeno vreme |
| tzwell | 0:4d143c75068e | 48 | |
| tzwell | 0:4d143c75068e | 49 | } |
| tzwell | 0:4d143c75068e | 50 | } |
| tzwell | 0:4d143c75068e | 51 | |
| tzwell | 0:4d143c75068e | 52 | |
| tzwell | 0:4d143c75068e | 53 | /* |
| tzwell | 0:4d143c75068e | 54 | * Definicija funkcija: |
| tzwell | 0:4d143c75068e | 55 | */ |