/*############################################################# Program Name : ex3_button_led Author : Grant Phillips Date Modified : 12/01/2016 Compiler : ARMmbed Tested On : STM32F4-Discovery Description : Reads the value of button and then turns an LED ON when the button is ON otherwise the LED is turned OFF. Requirements : * STM32F4-Discovery Board Circuit : * a pushbutton connected to PE8 with a pullup resitor * a LED connected to PD8 ##############################################################*/ #include "mbed.h" DigitalIn button(PE_8); DigitalOut led(PD_8); int main() { while(1) { if (button == 0) //inverse logic due to external pullup resistor on button led = 1; else led = 0; } }