miniblip button example

Dependencies:   mbed

Committer:
pighixxx
Date:
Thu Nov 26 09:26:11 2015 +0000
Revision:
0:c743f6be0671
miniblip button example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pighixxx 0:c743f6be0671 1 // miniblip onboard buttons
pighixxx 0:c743f6be0671 2
pighixxx 0:c743f6be0671 3 // main button: P0_23
pighixxx 0:c743f6be0671 4 // progr button: P0_1
pighixxx 0:c743f6be0671 5 // vibration/tilt: P1_15
pighixxx 0:c743f6be0671 6 // external buttons: P0_15, P0_14, P0_13, P0_12, P0_11
pighixxx 0:c743f6be0671 7 // encoder: P0_20, P0_2
pighixxx 0:c743f6be0671 8 // encoder button: P1_19
pighixxx 0:c743f6be0671 9 // ext (top/left): P0_21
pighixxx 0:c743f6be0671 10
pighixxx 0:c743f6be0671 11 #include "mbed.h"
pighixxx 0:c743f6be0671 12
pighixxx 0:c743f6be0671 13 DigitalIn pushbutton(P0_23); //Define pushbutton
pighixxx 0:c743f6be0671 14 Serial pc(USBTX, USBRX); // Define serial TX RX
pighixxx 0:c743f6be0671 15
pighixxx 0:c743f6be0671 16 int main() {
pighixxx 0:c743f6be0671 17 while(1) {
pighixxx 0:c743f6be0671 18 if (pushbutton) {
pighixxx 0:c743f6be0671 19 pc.printf("Hello World");
pighixxx 0:c743f6be0671 20 wait(1); // Waits 1 second and print Hello World again
pighixxx 0:c743f6be0671 21 }
pighixxx 0:c743f6be0671 22 }
pighixxx 0:c743f6be0671 23 }