Paso 2: codificación
Abrir y acceder a mbed para compilador . Haga clic en nuevo. Asegúrese de que está seleccionado el NUCLEO-F103EB plataforma. De plantilla, seleccione Blinky LED Hello World. Escriba Nombre de programa y haga clic en Aceptar. Ahora, abra el archivo main.cpp y quite todo el código escrito allí. y pegar en el código siguiente:
#include "mbed.h"//bluetooth module employs Serial Communication. Serial blutooth(PA_9, PA_10);//Tx, RxDigitalOut myled(LED1); //LED on your Nucleo Board DigitalIn btn1(PC_13); //Button on your Nucleo Boardint main() { float i = 1; //This will print Hello World onto your SmartPhone blutooth.printf("Hello World !\r\n"); while(1) { wait(1); blutooth.printf("This program runs since %f seconds.\r\n", i++); if(btn1) { myled=1; } else { myled=0; } } }
Compilar y descargar el archivo .bin al Consejo de núcleo.