Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 5 months ago.
Can't get Timeout to work
Take a look on this code:
- include "mbed.h"
Timeout flipper; DigitalOut led1(LED1);
void flip() { led1 = !led1; }
int main() { flipper.attach(&flip, 2.0);
while(1) { wait(4.0); printf("asd\r\n"); } }
The led is not blinking, I've been trying with both the online compiler and my offline toolchain, on the offine toolchain I set a breakpoint on the line that should flip the led and the execution doesn't get there. I tested the code on a F401RE and on a L152RE, same result.
Question relating to:
1 Answer
10 years, 5 months ago.
You may want to look up the difference between timeout and ticker. It may also be worthwhile to initialise your led1 object to either 1 or 0 before you call flipper.attach(). I hope this helps.