TP1_exo4

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mbedo
Date:
Thu Oct 23 12:12:09 2014 +0000
Commit message:
TP1_exo4

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r e8cbbc2bf290 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 23 12:12:09 2014 +0000
@@ -0,0 +1,53 @@
+#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;
+        
+        }
+    }
+}
+
diff -r 000000000000 -r e8cbbc2bf290 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Oct 23 12:12:09 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013
\ No newline at end of file