Program for NUCLEO-L476RG which uses mbed.h to demonstrate USER BUTTON usage (19E042PIM).

Dependencies:   mbed

main.cpp

Committer:
tzwell
Date:
2021-10-11
Revision:
0:2338470bb540
Child:
1:8d38990190c1

File content as of revision 0:2338470bb540:

/*
 * Primer pritiska tastera za STM32L476RG 
 * napisan koristeci mbed.h biblioteku.
 *
 * Katedra za Elektroniku i digitalne sisteme
 * Elektrotehnicki fakultet
 * Beograd 
 *
 * Oktobar 2021.
 *
 */

/*
 * Biblioteke za uvoz:
 */
#include "mbed.h"

/*
 * Definisanje makroa:
 */
 #define PERIOD_POLIRANJA 50
/*
 * Globalne promenljive:
 */
DigitalOut DiodicaNaPloci (LED1);     // Kreiranje promenljive diode
DigitalIn TasterNaPloci (BUTTON1);    // Kreiranje promenljive tastera 
/*
 * Deklaracija funkcija:
 */

/*
 * Glavna funkcija:
 */
int main()
{   
    // Glavna petlja:
    while(true)
    {
        DiodicaNaPloci = !TasterNaPloci;// Dioda preuzima vrednost tastera 
        wait_ms(PERIOD_POLIRANJA);      // Program ceka neki period poliranja
    }    
}

/*
 * Definicija funkcija:
 */