Luca Mottola
/
IOTAtelier1819-DISCO-ButtonInterrupt
Example using the user button on DISCO L475E IOT01, using interrupts
main.cpp
- Committer:
- lmottola
- Date:
- 2018-11-08
- Revision:
- 0:fc82b2d5fe07
File content as of revision 0:fc82b2d5fe07:
#include "mbed.h" InterruptIn button(USER_BUTTON); DigitalOut led(LED1); DigitalOut heartbeat(LED2); void toggle() { led = !led; } int main() { button.rise(&toggle); // Call toggle function on the rising edge while(1) { // Wait around, interrupts will interrupt this! heartbeat = !heartbeat; wait(0.25); } }