Halilovic Almin Beganovic Benjamin

Dependencies:   mbed

main.cpp

Committer:
tim007
Date:
2014-03-17
Revision:
0:0cd8fdc1cc07

File content as of revision 0:0cd8fdc1cc07:

#include "mbed.h"

#define WAIT_TIME 0.001

BusOut cifra_za_ispis(dp2, dp1, dp28, dp6, dp5, dp27, dp26);//dp2, dp1, dp28, dp6, dp5, dp27, dp26   dp26, dp27, dp5, dp6, dp28, dp1, dp2
DigitalOut tacka(dp4);
BusOut red_br_cifre(dp25, dp24, dp23);//dp25 dp24 dp23
DigitalOut enable_display(dp14);

int main()
{
    enable_display=1;
    
    //0-9,a-d,*,#
    //               126, 48, 109, 121, 51, 91, 95, 114, 127, 123, 119, 31, 78, 61, 99, 55
    int karakteri[]={  1, 79,  18,   6, 76, 36, 32,  13,   0,   4,   8, 96, 49, 66, 28, 72};
    int broj_cifre[]={3, 5, 6};//4, 2, 1     3, 5, 6
    int cifre[]={0, 0, 0};
    
    cifra_za_ispis=127;
    tacka=1;    

    while(1)
    {
        for(int j(1); j<=666; j++)
        {
        for(int i(0); i<3; i++)
        {
            red_br_cifre=broj_cifre[i];
            if(i==1) tacka=0;//1
            cifra_za_ispis=karakteri[ cifre[i] ];
            wait(WAIT_TIME);
            tacka=1;//0
        }///trajanje petlje = 0.003s
        }///trajanje petlje = 1.998s
        wait(0.002);
        
        
        
        for(int n(0); n<2; n++)
        {
            cifre[0]=n;

            for(int t(0); t<10; t++)//10 sekundi
            {
                cifre[1]=t;

                for(int j(0); j<10; j++)//sekunda
                {
                    cifre[2]=j;

                    for(int k(0); k<33; k++)
                    {
                        if(cifre[0]==1 && cifre[1]==2 && cifre[2]==3)
                            k--;///petlja ce zbog ovog biti beskonacna i time smo stopirali ispis :D

                        for(int i(0); i<3; i++)
                        {
                            //if(k==6 && i==3) break;
                            red_br_cifre=broj_cifre[i];
                            if(i==1) tacka=0;//1
                            cifra_za_ispis=karakteri[ cifre[i] ];
                            wait(WAIT_TIME);
                            tacka=1;//0
                        }///trajanje petlje = 0.003s
                    }
                    wait(0.001);
                    ///desetinka

                }//sekunda
            }//10sekundi
        }
    }
    return 0;
}