tim003 tim003
/
LV4_Grupa6_Tim003_zad1
Ensar Muratović Josip Kvesić
main.cpp
- Committer:
- tim003
- Date:
- 2014-03-27
- Revision:
- 1:eedf2d818394
- Parent:
- 0:25c7de2b9a11
File content as of revision 1:eedf2d818394:
#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),(int)(value*10) % 10,(int)(value*100) % 10}; for(int i = 1; i <= 4; i = i * 2) { broj = segmenti[ TCifre[i / 2] ]; cifra = ~i; tacka = (i == 1) ? 0 : 1; wait_ms(1); cifra=7; } } int main() { float niz[50]; float suma=0; float vrijednost=0; while(1){ for(int i(0);i<50;i++){ niz[i]=ain*3.3; suma+=niz[i];} vrijednost=suma/50; display(vrijednost); suma=0; } }