Anes Luckin Selma Tucak

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 BusOut led(dp26, dp27, dp5, dp6, dp28, dp1, dp2);
00004 BusOut dec(dp23, dp24, dp25);
00005 BusOut tacka(dp4);
00006 
00007 int broj[10] = {0x40, 0x79, 0x24, 0x30, 0x19, 0x12, 0x02, 0x78, 0x00, 0x10};
00008 
00009 Timer brojac;
00010 
00011 void funk(float v)
00012 {
00013                int des= (int) (v)/10;
00014                 int jed = (int) (v)%10;
00015                 int stot = (v -int(v))*10;
00016               led=broj[stot];
00017               dec=3;
00018 wait_ms(2);
00019 
00020 led=broj[jed];
00021 dec=5;
00022 tacka=0;
00023 
00024 wait_ms(2);
00025 
00026 
00027 tacka=1;
00028  led=broj[des];
00029 dec=6;
00030 
00031  wait_ms(2);
00032  
00033  dec=7;
00034                 
00035 }
00036 
00037 int main() {
00038     dec = 0;
00039     led = broj[0];
00040     wait(2);
00041     brojac.start();
00042     float v = 0;
00043     
00044     while(1) {
00045     
00046     if(v<=12.3)
00047         v = brojac.read();
00048         funk(v);
00049     }
00050 }