SNE S1/S2 prime
/
NUCLEO_446RE_ticker_flag
ticker flag
Diff: main.cpp
- Revision:
- 4:f331cf018c19
- Parent:
- 3:8a79f8ce8378
--- a/main.cpp Mon Nov 09 16:10:15 2020 +0000 +++ b/main.cpp Mon Nov 09 16:54:22 2020 +0000 @@ -1,19 +1,22 @@ #include "mbed.h" -// interruption periodique directe +// interruption periodique flag DigitalOut ledr(PB_4);//LED_red Ticker t1; +unsigned int flag=0; void clignote_led(void); int main() { - unsigned char DOWN_P=0; ledr=1; // led r eteinte - t1.attach(&clignote_led, 1.00); + t1.attach(&clignote_led, 0.1); while(1) { + if(flag==1) { + flag=0; + ledr=!ledr; + } } } void clignote_led(void) { - ledr=!ledr; + flag=1; } -