Dependencies:   mbed

Revision:
0:2feddd16d4d9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri May 09 15:33:23 2014 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+
+struct players{
+    char name;
+    int score;
+}player1, player2;
+
+
+PwmOut myled(LED1);
+DigitalIn bplayer1(D2);
+DigitalIn bplayer2(D3);
+Serial pc(USBTX, USBRX);
+
+void printScore();
+
+int main() {
+    player1.name = 'a';
+    player2.name = 'b';
+    while(1) {
+    
+        if (bplayer1 == 1 && bplayer2 == 0){
+            player1.score = player1.score + 1;
+            printScore();
+        }else if(bplayer1 == 0 && bplayer2 == 1){
+            player2.score = player2.score + 1;
+            printScore();
+        }
+    }
+}
+
+
+void printScore(){
+    myled = 1;
+    pc.printf("Jugador %c: \t puntos: %d\n", player1.name, player1.score); 
+    pc.printf("Jugador %c: \t puntos: %d\n", player2.name, player2.score); 
+    wait(1);
+    myled = 0;
+}
\ No newline at end of file