Hi. I’m trying to write a program to make an LED turn on by pressing 1 and turn off again by pressing 0. I’m using the STM32 Discovery Kit by ST Electronics (B-L475E-IOT01A).
I think the problem is that setting the baud rate does not work.
Here is my code so far:
#include "mbed.h"
DigitalOut led1(PC_5);
BufferedSerial pc(USBTX, USBRX);
int main(){
int toggle;
pc.set_baud(115200);
printf("This is the bare metal blinky example running on Mbed OS %d.%d.%d.\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
while (true)
{
printf("Please type 1 or 0:");
scanf("%i", &toggle);
printf("%i \n", toggle);
led1.write(toggle);
}
}
Any ideas? It does not work!