TP2_exo4

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mbedo
Date:
Thu Oct 23 12:14:30 2014 +0000
Commit message:
TP2_exo4

Changed in this revision

Exo4.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Exo4.cpp	Thu Oct 23 12:14:30 2014 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+ 
+AnalogIn ain(p19);
+AnalogIn ain2(p20);
+DigitalOut led(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+ 
+int main() {
+    while (1){
+        if(ain > 0.3) {
+            led = 1;
+            wait(0.25);
+        } else {
+            led = 0;
+        }
+        if(ain > 0.25) {
+            led2 = 1;
+            wait(0.25);
+        } else {
+            led2 = 0;
+        }
+        if(ain > 0.2) {
+            led3 = 1;
+            wait(0.25);
+        } else {
+            led3 = 0;
+        }
+        if(ain > 0.15) {
+            led4 = 1;
+            wait(0.25);
+        } else {
+            led4 = 0;
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Oct 23 12:14:30 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file