Anoney Potter
/
Nucleo_printf
Nucleo_printf
main.cpp
- Committer:
- anoney180133
- Date:
- 2015-12-11
- Revision:
- 0:eb4797d75974
File content as of revision 0:eb4797d75974:
#include "mbed.h" //------------------------------------ // Hyperterminal configuration // 115200 bauds(Default 9600), 8-bit data, no parity //------------------------------------ /* No need Serial to UART just usb debugger. */ Serial UART(SERIAL_TX, SERIAL_RX); // TX PA_2 , RX PA_3 DigitalOut LED(D13,0); DigitalOut LED_debug(D7,0); void UARTIrq(); int main() { unsigned int i = 0; UART.baud(115200); // Set BuadRate UART.attach(UARTIrq,Serial::RxIrq); printf("Hello World !\r\n"); while(1) { wait(1); printf("This program runs since %d seconds.\r\n", i++); } } void UARTIrq() { char input_char = UART.getc(); LED_debug = !LED_debug ; if(input_char == '1') { LED = 1; } else if(input_char == '0') { LED= 0; } }