Ruleta
main.cpp
- Committer:
- darkmx4
- Date:
- 2013-10-31
- Revision:
- 0:a176fa6b4afd
- Child:
- 1:b11ca82c2be8
File content as of revision 0:a176fa6b4afd:
// Analog Read #include "mbed.h" Serial pc(USBTX,USBRX);// tx, rx BusOut leds(PTD4, PTA12, PTA4, PTA5, PTC8, PTC9, PTA13, PTD5); DigitalOut led1(PTD4); DigitalOut led2(PTA2); DigitalOut led3(PTA4); DigitalOut led4(PTA5); DigitalOut led5(PTC8); DigitalOut led6(PTC9); DigitalOut led7(PTA13); DigitalOut led8(PTD5); AnalogIn pot(PTB0); DigitalIn boton(PTB1); DigitalIn botonr(PTB2); int score = 100; int on; int main() { while(1){ float input = pot; on = 1; leds = on; wait(pot + .015); on = on <<1; if(on ==256) { on = 1; } boton.mode(PullUp); botonr.mode(PullUp); pc.printf("Tu puntaje es de 100 puntos.\n"); char c = pc.getc(); if(botonr ==0) { wait(0.5); score = 100; pc.printf("Reiniciando"); } else if(boton==0 || led8 ==1) { wait(0.5); score += 100; pc.printf("Felicidades! Ganaste 10 puntos.\n"); wait(0.5); } else if(boton==0 || led8 != 1) { wait(0.5); score -= 250; pc.printf("Fallaste, Pierdes 25 puntos.\n"); wait(0.5); } } }