Skip to content
Permalink
e88b206f40
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
40 lines (24 sloc) 710 Bytes
#include <mbed.h>
#include <flasher.h>
// Global Flasher Object
Flasher theFlasher(LED2, 0);
// Variable to hold button State, this needs to be globally avaialable
int buttonState;
// Hander Function for our Buton Press
void handler(){
buttonState = !buttonState;
theFlasher.set_state(buttonState);
}
int main() {
// put your setup code here, to run once:
//Setup the User Buton as an Input
InterruptIn theButton(BUTTON1);
//Bind the interupt to a function
theButton.rise(&handler);
while(1) {
// put your main code here, to run repeatedly:
//Print the State of our button
printf("Button State is %d\n", buttonState);
theFlasher.flash();
}
}