TP1_exo4

Dependencies:   mbed

main.cpp

Committer:
mbedo
Date:
2014-10-23
Revision:
0:e8cbbc2bf290

File content as of revision 0:e8cbbc2bf290:

#include "mbed.h"
 
PwmOut led(LED1);     // on initialise nos 4 leds en utilisant l'interface PwmOut
PwmOut led2(LED2);
PwmOut led3(LED3);
PwmOut led4(LED4);
 
int main() {
    while(1) {
        for(float p = 0.0f; p < 1.0f; p += 0.1f) {    // la led1 s'allume progressivement 
            led = p;                                  // 
            wait(0.1);
        }
        for(float p = 1.0f; p >= 0.0f; p -= 0.1f) {
            led = p;
            wait(0.1);
            led=0;
        
        }
        for(float p = 0.0f; p < 1.0f; p += 0.1f) {
            led2 = p;
            wait(0.1);
        }
        
        for(float p = 1.0f; p >= 0.0f; p -= 0.1f) {
            led2 = p;
            wait(0.1);
            led2=0;
        
        }
        for(float p = 0.0f; p < 1.0f; p += 0.1f) {
            led3 = p;
            wait(0.1);
        }
        for(float p = 1.0f; p >= 0.0f; p -= 0.1f) {
            led3 = p;
            wait(0.1);
            led3=0;
        
        }
        for(float p = 0.0f; p < 1.0f; p += 0.1f) {
            led4 = p;
            wait(0.1);
        }
        for(float p = 1.0f; p >= 0.0f; p -= 0.1f) {
            led4 = p;
            wait(0.1);
            led4=0;
        
        }
    }
}