Button's on the testbed

27 Aug 2012

Hey! Is anyone here there using the testbed for mbed? I don't know how the pin's are named and it isn't in the manuals. I want to use the two buttons.

DigitalIn buttonA (p?); DigitalIn buttonB (p?);


That's the only thing I've found and the pin's are not p8 and p14, respectively it does not work this way.

(Sorry for the bad grammar ;) )

Please help me. :)

27 Aug 2012

Hi Franziska, this is one of the first codes i tried on my TestBed and it is working. Where do you have problems? Keep in mind that p14 is also used for the SDCard and could give trouble. Have fun.

#include "mbed.h"

DigitalOut myled(LED1);
DigitalIn BTN1(p8); //Define pushbutton on pin 8
DigitalIn BTN2(p14); //Define pushbutton on pin 14
Serial pc(USBTX, USBRX);

int main() {

    printf("ElMicro TestBED-Karte\n"); 
    printf("warte auf BTN's\n"); 
    while(1) {
        if (!BTN1) { pc.printf("BTN 1\n"); }
        if (!BTN2) { pc.printf("BTN 2\n"); }
        myled = 1;
        myled = 0;

29 Aug 2012

Hi Franziska, hi voy ager,

thanks for using our TestBed! The button inputs are p8 and p14. They are "high" when released and "low" when pressed. This is what voy ager's code does with if(!BTN1) {..}.

Due to the GPIO limitations of mbed, we shared signal p14 with the Chip Select signal of the SD-Card slot. So you can't proper use BTN2 when using SD cards. Chapter 3 "Combination of peripherals" in the TestBed manual doesn't mention the input buttons as a TestBed function, sorry about that.

Best regards, Stefan.

PS: You can always contact us at support@elmicro.com!

23 Apr 2014


I tried the code posted by voy ager, but only BTN1 is working. Do I have to make any changes regarding that BTN2 and the SD card share p14? The SD card is not needed for my purpose.