Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- 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