Use of interrupts example for NMHU ambient computing class Sp2015. added MMA8451Q8 library to use as point of departure.

Dependencies:   MMA8451Q8b SLCD mbed

Fork of KL46z_all_interrupt by Stanley Cohen

main.cpp

Committer:
bcostm
Date:
2014-02-21
Revision:
0:912303e63cbd
Child:
1:65b0e488f02a

File content as of revision 0:912303e63cbd:

#include "mbed.h"
 
InterruptIn mybutton(USER_BUTTON);
DigitalOut myled(LED1);
 
float delay = 1.0; // 1 sec
 
void pressed()
{
    if (delay == 1.0)
        delay = 0.2; // 200 ms
    else
        delay = 1.0; // 1 sec
}
 
int main()
{
    mybutton.fall(&pressed);
    while (1) {
        myled = !myled;
        wait(delay);
    }
}