
LAB#1: InterruptIn
Emb_LAB1.cpp
- Committer:
- hulmpants
- Date:
- 2019-08-15
- Revision:
- 1:cd0e7975714c
File content as of revision 1:cd0e7975714c:
// IT Tralee Mechatronics: Embedded Systems LAB#1 #include "mbed.h" InterruptIn d(p12); // down InterruptIn l(p13); // left InterruptIn c(p14); // centre InterruptIn u(p15); // up InterruptIn r(p16); // right DigitalOut flash(LED1); void left() { printf("Left \n \r"); // print } void right() { printf("Right \n \r"); } void up() { printf("Up \n \r"); } void down() { printf("Down \n \r"); } void centre() { printf("Centre \n \r"); } int main() { l.rise(&left); // address to interrupt rising edge r.rise(&right); u.rise(&up); d.rise(&down); c.rise(¢re); while(1) { // LED flash = interrupt active flash = !flash; wait(0.2); } }