NUCLEO-F042K6 Simple demo with button interrupt input
Dependencies: mbed
main.cpp
- Committer:
- vodsejak
- Date:
- 2018-02-17
- Revision:
- 1:129f63c021d8
- Parent:
- 0:32b38fc2ecec
File content as of revision 1:129f63c021d8:
#include "mbed.h" /******************************************************************************* EXAMPLE DESCRIPTION Sets digital in on PA_0 with internal pull up. On falling edge (button press) interrupt that toggles onboard LED is called. *******************************************************************************/ InterruptIn button(PA_0); // deffition of interrupt DigitalOut LED(LED1); // definition of digital out pin // toggles LED void pressed() { LED=!LED; } int main() { button.fall(&pressed); // Set button interrupt button.mode(PullUp); // set internal pull up while(1) { // can do other things } }