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.
mbed_sleep_blinky.cpp
- Committer:
- pateshian
- Date:
- 2016-11-17
- Revision:
- 0:ab9939da6645
- Child:
- 1:e508448feb1c
File content as of revision 0:ab9939da6645:
#include "mbed.h"
#define IRQ4 (36)
gpio_irq_t irqHandler;
DigitalOut led1(LED1);
int gFlag = 0;
void interrupt_irq4_user (uint32_t id, gpio_irq_event event) {
if (!gFlag){
gFlag = 1;
}
}
// main() runs in its own thread in the OS
// (note the calls to Thread::wait below for delays)
int main() {
gpio_irq_init (&irqHandler, USER_BUTTON0, interrupt_irq4_user, IRQ4);
while (true) {
if ( gFlag == 1 ) {
gFlag = 0;
led1 = led1;
__WFI();
led1 = !led1;
}
//led1 = !led1;
//Thread::wait(500);
}
}