Equipo 13
/
parcial
Ruleta de lees
Revision 0:3a9a89ac25e7, committed 2013-11-04
- Comitter:
- Equipo13
- Date:
- Mon Nov 04 15:34:21 2013 +0000
- Commit message:
- Parcial;
Changed in this revision
diff -r 000000000000 -r 3a9a89ac25e7 TSI.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TSI.lib Mon Nov 04 15:34:21 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/vsluiter/code/TSI/#4dc2f5a3a731
diff -r 000000000000 -r 3a9a89ac25e7 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Nov 04 15:34:21 2013 +0000 @@ -0,0 +1,55 @@ +#include "mbed.h" +DigitalOut myled(LED1); +BusOut leds(PTA5, PTA13, PTC9, PTC8, PTD5, PTD4, PTA12, PTA4); //Para controlar varios puertos al mismo tiempo +AnalogIn pot(PTB3); //PTA13, PTD5 +DigitalIn BS(PTD2); +DigitalIn BR(PTD0); +Serial pc(USBTX, USBRX); + + + +int main() { +myled = 1; +int count = 0; +int reps = 10; //modifica este valor para hacer la secuencia mas rapida o lenta + +int points = 100; +int on = 1; //variable que me va a decir que led o leds encender, recuerda que los + //leds rgb funcionan con logica inversa + while(1) { + leds = on; //asigno el valor de on a los leds + while(count < reps){ //equivalente a un wait de aprox 100 ms + wait(0.1 - pot/10 + .015); + if (BS == 0 && D4 == on){ + points = points + 10; + pc.printf ("Ganaste! Tus puntos son %d\n", points); + on = 128; + wait (0.5); + } + if (BS == 0 && D4 != on){ + points = points - 10; + pc.printf ("perdiste! Tus puntos son %d\n", points); + on = 128; + wait (0.5); + } + if (BR == 0){ + points = 100; + pc.printf ("Tu juego se a reseteado, ahora tienes %d\n", points); + on = 128; + wait (0.5); + } + count ++; + + } + count = 0; + on = on << 1; //recorro un bit a la izquierda piensa en binario (001 recorriendo queda 010) + if (on == 256){ //Si vale 8 o en binario 1000 reseteo el valor a 1 o 001 en binario + on = 1; + } + } +} + + + + +
diff -r 000000000000 -r 3a9a89ac25e7 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Nov 04 15:34:21 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file