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.
Dependencies: TextLCD mbed MMA8451Q TSI
Button.cpp
- Committer:
- mfurlanetto
- Date:
- 2015-08-14
- Revision:
- 1:47973f27d645
- Parent:
- 0:f48fccfff709
- Child:
- 2:86de87ec731a
File content as of revision 1:47973f27d645:
#include "mbed.h" #include "Speaker.h" class Button { public: Button(PinName pin, int note, bool* buffer, DigitalOut* myled) : _interrupt(pin) { _code=note; led=myled; noteRegister=buffer; _interrupt.rise(this, &Button::release); _interrupt.fall(this, &Button::press); isPressed=false; } void press() { *noteRegister=true; *led=0; } void release() { *noteRegister=false; *led=1; } private: InterruptIn _interrupt; int _code; bool* noteRegister; DigitalOut* led; bool isPressed; };