Marko Marinović
/
Konstrukcijski_LAMPICE
Konstrukcijski rad
Diff: main.cpp
- Revision:
- 0:89c243df8710
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 06 19:27:34 2021 +0000 @@ -0,0 +1,49 @@ +#include "mbed.h" +#include "LAMPICE.h" +LAMPICE LED(PC_8, PC_6, PC_5, PA_12, PC_9, PB_8); +Serial pc(USBTX, USBRX); +InterruptIn TIPKALO2(PB_9); +DigitalOut LEDICA1(PC_8); +Ticker serial; + +int x=0; +volatile int n=0; + + + +void brojac(){ + n++; + if(n>2){ + n=0; + } +} + + + +void komunikacija(){ + pc.printf("%d", x); +} + + + +int main() +{ + TIPKALO2.mode(PullDown); + TIPKALO2.rise(&brojac); + serial.attach(&komunikacija, 5); + while(1){ + switch(n){ + case 1: + x = LED.flash(x); + break; + case 2: + LEDICA1=!LEDICA1; + wait(2); + LEDICA1=!LEDICA1; + wait(1); + break; + } + + } + +} \ No newline at end of file