Final

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Equipo13
Date:
Fri Nov 15 05:02:55 2013 +0000
Commit message:
final;

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 b2579e84679b main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Nov 15 05:02:55 2013 +0000
@@ -0,0 +1,62 @@
+#include "mbed.h"
+
+DigitalIn B1(PTD2);
+DigitalIn B2(PTD0);
+DigitalOut myled(LED1);
+DigitalOut myled2(LED2);
+
+Serial pc(USBTX, USBRX);
+
+int main() {
+int point = 100;
+int count = 0;
+int reps = 100; 
+myled=1;
+myled2 = 1;
+    while(1) {
+        float random = rand()%2;
+        //pc.printf ("random es %f\n", random);
+        
+        while(count < reps){  //equivalente a un wait de aprox 100 ms
+            wait(0.1);
+            if (random == 0){
+                myled = 0;
+            }
+            else {
+                myled2 = 0;
+            }
+            if (B1 == 0 && random == 0){
+                myled = 1;
+                count = 100;
+                point = point + 50;
+
+            }
+            if (B1 == 0 && random == 1){
+                myled = 1;
+                count = 100;
+                point = point - 50;
+
+            }
+            
+            if (B2 == 0 && random == 1){
+                myled2 = 1;
+                count = 100;
+                point = point + 50;
+            }
+            
+            if (B2 == 0 && random == 0){
+                myled2 = 1;
+                count = 100;
+                point = point - 50;
+
+            }
+            
+            count ++;
+        }
+    pc.printf ("rtus puntos son %d\n", point);
+    myled = 1;
+    myled2 = 1;
+    wait (3);
+    count = 0;
+    }
+}
diff -r 000000000000 -r b2579e84679b mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Nov 15 05:02:55 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file