Ensar Muratović Josip Kvesić

Dependencies:   mbed

main.cpp

Committer:
tim003
Date:
2014-03-27
Revision:
0:c91934fda56f

File content as of revision 0:c91934fda56f:

#include "mbed.h"

BusOut broj(dp2, dp1, dp28, dp6, dp5, dp27, dp26);
BusOut cifra(dp23, dp24, dp25);
DigitalOut tacka(dp4);
AnalogIn ain(dp9);
 
int segmenti[10] = {0x01, 0x4f, 0x12, 0x06, 0x4c,0x24, 0x20, 0x0f, 0x00, 0x04};
 
void display(float value)
{
    int TCifre[3] = {(int)(value/10),(int)(value) % 10,(int)(value*10) % 10};
    for(int i = 1; i <= 4; i = i * 2)
    {
        broj = segmenti[ TCifre[i / 2] ];
        
        cifra = ~i;
        wait_ms(1);
        cifra=7;
    }
 
}
 
int main()
{   
    float max=2.4;
    float min=0.8;
    float raz=max-min;
    float d=0;
    int i=0;
    while(1){
        
        
        if((ain*33)>=min && (ain*3.3)<=max)
        d=1-((ain*3.3)-min)/raz;
        else 
        d=0;
        display(d*100);
        i++;
        }
        
}