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.
main.cpp
- Committer:
- ellieoin
- Date:
- 2020-08-15
- Revision:
- 0:c24760f7606a
- Child:
- 1:44689d969206
File content as of revision 0:c24760f7606a:
#include "mbed.h" #define BTN_DOWN p12 #define BTN_LEFT p13 #define BTN_CENTER p14 #define BTN_UP p15 #define BTN_RIGHT p16 InterruptIn btn_down(BTN_DOWN); InterruptIn btn_left(BTN_LEFT); InterruptIn btn_center(BTN_CENTER); InterruptIn btn_up(BTN_UP); InterruptIn btn_right(BTN_RIGHT); void print_down() { printf("DOWN\n"); } void print_left() { printf("LEFT\n"); } void print_center() { printf("CENTER\n"); } void print_up() { printf("UP\n"); } void print_right() { printf("RIGHT\n"); } int main() { while (1) { btn_down.rise(callback(&print_down)); btn_left.rise(callback(&print_left)); btn_center.rise(callback(&print_center)); btn_up.rise(callback(&print_up)); btn_right.rise(callback(&print_right)); } }