/*############################################################# Program Name : ex5_sw_leds_pullup Author : Grant Phillips Date Modified : 12/01/2016 Compiler : ARMmbed Tested On : STM32F4-Discovery Description : Reads the value of 8 switches on an input port (using the internal pullup resistors) and displays this value on 8 LEDs. Requirements : * STM32F4-Discovery Board Circuit : * 8 LEDs connected to PD15 - PD8 * 8 switches connected to PE15 - PE8 WITHOUT pullup resitors ##############################################################*/ #include "mbed.h" BusOut myleds(PD_8, PD_9, PD_10, PD_11, PD_12, PD_13, PD_14, PD_15); // bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 . . . BusIn switches(PE_8, PE_9, PE_10, PE_11, PE_12, PE_13, PE_14, PE_15); // bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7 . . . int main() { switches.mode(PullUp); //set the input mode to PullUp to use internal pullup resistors while(1) { myleds = switches; } }