Example using the user button on DISCO L475E IOT01, using busy waits

Dependencies:   mbed

main.cpp

Committer:
lmottola
Date:
2018-11-08
Revision:
0:e7c102a4c673

File content as of revision 0:e7c102a4c673:

#include "mbed.h"

DigitalIn button(USER_BUTTON); // Change to match your board
DigitalOut led(LED1);

#define BUTTON_PRESS 0

int main() {
    while(1) {
        if(BUTTON_PRESS == button){
           led = !led;
           wait(1);
       }
    }
}