cc

Dependencies:   mbed TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Exercice_1.cpp Source File

Exercice_1.cpp

00001 /*
00002 #include "mbed.h"  
00003 BusOut myleds(LED4, LED3, LED2, LED1); 
00004 Timer timer1; // définition du timer 
00005 DigitalOut sortie1(p5); 
00006 //void tache1(void); // prototype de tache1
00007 int main() { 
00008     char x=0;
00009     timer1.start(); // déclenchement du timer 
00010     while(1) { 
00011         myleds.write(x);
00012         if(timer1.read_ms()>=1000){
00013             if(x==15){
00014                 x=0;
00015             }
00016             else{
00017                 x++;
00018                 }
00019             timer1.reset();
00020         } 
00021         if(timer1.read_ms()>=200)//
00022         {  
00023             tache1(); // appel de la fonction tache1
00024             timer1.reset(); // remise à zéro du timer 
00025         } 
00026     } 
00027 } 
00028 void tache1(void){ // fonction
00029 sortie1.write(!(sortie1.read()); // inversion
00030 } 
00031 */