for testing

Dependencies:   mbed

Fork of 2_two_buttons by MakingMusicWorkshop

main.cpp

Committer:
maclobski
Date:
2016-05-10
Revision:
1:83ad95149534
Parent:
0:49e04b14e729

File content as of revision 1:83ad95149534:

#include "mbed.h"       // this tells us to load mbed related functions

DigitalOut red(LED_RED);             // we create a variable 'red', use it as an out port
DigitalOut green(LED_GREEN);         // we create a variable 'green', use it as an out port

InterruptIn btn2(SW2);               // we create a variable 'btn2', use it as an in port
InterruptIn btn3(SW3);               // we create a variable 'btn3', use it as an in port

// YOUR CODE HERE
//REMOVE
static void toggle_red() {
    red = !red;
}
static void toggle_green() {
    green = !green;
}
//END REMOVE

// this code runs when the microcontroller starts up
int main() {
    green = red = 1; // turn off green and red on startup (1=off, I know it's weird)
    
    btn2.fall(toggle_red);
    btn3.fall(toggle_green);
    
    // spin in a main loop. Wait for interrupts.
    while(1) {}
}