Julien Deschamps / Mbed 2 deprecated projetv1

Dependencies:   mbed

Committer:
dg81
Date:
Mon May 04 12:49:19 2020 +0000
Revision:
0:b5c75bc6000e
Child:
1:8e1033a40696
timer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dg81 0:b5c75bc6000e 1 #include "mbed.h"
dg81 0:b5c75bc6000e 2
dg81 0:b5c75bc6000e 3 Serial pc(USBTX, USBRX,19200); // tx, rx sur les broches associées au bus USB
dg81 0:b5c75bc6000e 4 DigitalOut led1(LED1);
dg81 0:b5c75bc6000e 5 Ticker mon_IT; // on associe l'interface Timeout à l'objet mon_IT
dg81 0:b5c75bc6000e 6
dg81 0:b5c75bc6000e 7 void Interruption_timer() {
dg81 0:b5c75bc6000e 8 printf("coucou\n");
dg81 0:b5c75bc6000e 9 led1=!led1;
dg81 0:b5c75bc6000e 10 }
dg81 0:b5c75bc6000e 11
dg81 0:b5c75bc6000e 12 int main(void)
dg81 0:b5c75bc6000e 13 {
dg81 0:b5c75bc6000e 14 mon_IT.attach(&Interruption_timer,0.5); // l'interruption est associée au programme Interruption_timer et s'exécute toutes les 0.5s
dg81 0:b5c75bc6000e 15 // pour stopper mon_IT.detach();
dg81 0:b5c75bc6000e 16 while(1)
dg81 0:b5c75bc6000e 17 {
dg81 0:b5c75bc6000e 18 }
dg81 0:b5c75bc6000e 19 }
dg81 0:b5c75bc6000e 20
dg81 0:b5c75bc6000e 21