Konstrukcijski rad

Dependencies:   LAMPICE mbed

https://os.mbed.com/media/uploads/kurton_ing/shema.png

main.cpp

Committer:
kurton_ing
Date:
2021-05-06
Revision:
0:89c243df8710

File content as of revision 0:89c243df8710:

#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;                
        }
        
    }
     
}