Hello everyone,
I’m using a NUCLEO-L432KC board programmed with Mbed studio 1.4.5 and the library mbed-os-6.16.0-rc1.
I’d like to use the Ticker class for a project but I encountered some problems.
Trying to solve the problem I ended up testing the reference example that should toggle a led. To my surprise even the example does not work. Here is the code I tested:
#include "mbed.h"
Ticker flipper;
DigitalOut led1(LED1);
void flip()
{
led1 = !led1; //the led does not blink in the callback
}
int main()
{
flipper.attach(&flip, 200ms); // the address of the function to be attached (flip) and the interval (2 seconds)
// spin in a main loop. flipper will interrupt it to call flip
while (1) {
// led1 = !led1; //removing this comment the led blinks correctly
ThisThread::sleep_for(200ms);
}
}
Am I doing something wrong? Is the ticker not supported for this board?
Thanks in advance for any help!