Anes Luckin Selma Tucak

Dependencies:   mbed

main.cpp

Committer:
tim003
Date:
2014-03-20
Revision:
0:87d8d39674fb

File content as of revision 0:87d8d39674fb:

#include "mbed.h"

BusOut led(dp26, dp27, dp5, dp6, dp28, dp1, dp2);
BusOut dec(dp23, dp24, dp25);
BusOut tacka(dp4);

int broj[10] = {0x40, 0x79, 0x24, 0x30, 0x19, 0x12, 0x02, 0x78, 0x00, 0x10};

Timer brojac;

void funk(float v)
{
               int des= (int) (v)/10;
                int jed = (int) (v)%10;
                int stot = (v -int(v))*10;
              led=broj[stot];
              dec=3;
wait_ms(2);

led=broj[jed];
dec=5;
tacka=0;

wait_ms(2);


tacka=1;
 led=broj[des];
dec=6;

 wait_ms(2);
 
 dec=7;
                
}

int main() {
    dec = 0;
    led = broj[0];
    wait(2);
    brojac.start();
    float v = 0;
    
    while(1) {
    
    if(v<=12.3)
        v = brojac.read();
        funk(v);
    }
}