tim004 tim004
/
Zad1
Muharemović Emina, Sinanović Hamdija
Revision 0:6271f38dd284, committed 2014-03-20
- Comitter:
- tim004
- Date:
- Thu Mar 20 14:15:31 2014 +0000
- Commit message:
- LV3 - PAI - Grupa 5 - Tim004
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 6271f38dd284 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 20 14:15:31 2014 +0000 @@ -0,0 +1,81 @@ +#include "mbed.h" + +#define NULA 0x01 +#define JEDAN 0x4F +#define DVA 0x12 +#define TRI 0x06 +#define CETIRI 0x4C +#define PET 0x24 +#define SEST 0x20 +#define SEDAM 0x0F +#define OSAM 0x00 +#define DEVET 0x04 +#define A 0x08 +#define B 0x60 +#define C 0x31 +#define D 0x42 +#define E 0x30 +#define F 0x38 +#define HASH 0x48 +#define ZVIJEZDA 0x7E + +#define PRVA 0x3 +#define DRUGA 0x5 +#define TRECA 0x6 + +DigitalOut enabled (dp14); +//BusOut vrijednost (dp26, dp27, dp5, dp6, dp28, dp1, dp2); +BusOut vrijednost (dp2, dp1, dp28, dp6, dp5, dp27, dp26); + +BusOut cifra (dp23, dp24, dp25); +DigitalOut tacka (dp4); + +int main() { + int vrijednosti[10] = {NULA, JEDAN, DVA, TRI, CETIRI, PET, SEST, SEDAM, OSAM, DEVET}; + int cifre[3] = {TRECA, DRUGA, PRVA}; + double t; + int v1, v2, v3, tacka1; + v1 = 0; + v2 = 0; + v3 = 0; + enabled = 1; + tacka1 = 1; + cifra = PRVA; + vrijednost = NULA; + tacka = 1; + cifra = DRUGA; + vrijednost = NULA; + tacka = 0; + cifra = TRECA; + vrijednost = NULA; + tacka = 1; + wait(2); + while(1) { + t = 0.001; + while(t<0.1/3) { + cifra = cifre[0]; + vrijednost = vrijednosti[v1]; + tacka = 1; + wait(0.001); + cifra = cifre[1]; + vrijednost = vrijednosti[v2]; + tacka = 0; + wait(0.001); + cifra = cifre[2]; + vrijednost = vrijednosti[v3]; + tacka = 1; + t += 0.001; + wait(0.001); + } + if(v3 != 9) v3++; + else { + v3 = 0; + if(v2 != 9) v2++; + else { + v2 = 0; + v1++; + } + } + if(v1 == 1 && v2 == 2 && v3 == 4) v3--; + } +}
diff -r 000000000000 -r 6271f38dd284 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 20 14:15:31 2014 +0000 @@ -0,0 +1,1 @@ +http://world3.dev.mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43 \ No newline at end of file