![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Marko_Marinic_0246048959
Dependencies: mbed SeeedShieldBot TextLCD BluetoothSerial
Diff: main.cpp
- Revision:
- 0:0b3b22a12941
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jul 13 15:31:59 2021 +0000 @@ -0,0 +1,57 @@ +#include "mbed.h" +#include "TextLCD.h" +#include "SegDisplay.h" +#include "Stanovi.h" +Serial pc(USBTX, USBRX); +TextLCD ZaslonLCD(PA_0, PA_1, PA_4, PB_0, PC_1, PC_0, TextLCD::LCD16x1); +AnalogIn AnalogniUlaz(D13); +float JacinaZvuka; +InterruptIn StartGumb(D15); +void Glavna(void); +Timer tajmer; +int main() { + tajmer.start(); + StartGumb.rise(&Glavna); +} +void Glavna() { + if (tajmer.read_ms()>200) { + SegInit(); + StanoviInit(); + ZaslonLCD.printf("\nMRAK!!!"); + while(1){ + int brojac1 = 0; + int brojac2 = 4; + JacinaZvuka=abs(AnalogniUlaz-0.064); + if(JacinaZvuka>0.1){ + ZaslonLCD.printf("\nPLJESAK!!!"); + for(int i =0;i<=10;i++){ + if(i==10){ + if(brojac2>3){ + brojac1++; + Stanovi=BrojStanova(brojac1); + i=0; + } + if(brojac1>=5){ + brojac2--; + Stanovi=ObrnutoBrojStanova(brojac2); + if(brojac2==0){ + brojac1=0; + brojac2=5; + Seg=SegConvert(0); + ZaslonLCD.printf("\nMRAK!!!"); + break; + } + i=0; + } + } + Seg=SegConvert(i); + wait(0.3); + } + } + pc.printf("JacinaZvuka... \n\r"); + pc.printf("%f \n\r",JacinaZvuka); + } +} +} + +