Gerardo Carmona
/
info_data_structures
Revision 0:2feddd16d4d9, committed 2014-05-09
- Comitter:
- gcarmonar
- Date:
- Fri May 09 15:33:23 2014 +0000
- Commit message:
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 2feddd16d4d9 main.cpp --- /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
diff -r 000000000000 -r 2feddd16d4d9 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri May 09 15:33:23 2014 +0000 @@ -0,0 +1,1 @@ +http://world3.dev.mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43 \ No newline at end of file