2020/0425 Milos Novakovic

Dependencies:   mbed

main.cpp

Committer:
mlos55
Date:
2021-11-06
Revision:
0:e776d140b732
Child:
1:4bf71be0038a

File content as of revision 0:e776d140b732:


//Uvoz biblioteka i def direktiva

#include "mbed.h"
/*
#define A PA_10;
#define B PA_9;
#define C PA_8;
#define D PB_10;
#define E PB_5;
#define F PB_4;
#define G PB_3;
///#define 
//#define SEL1 PB_6;
//#define SEL2 PC_7;
*/

//Globalne promjenljive

BusOut display1(PA_10, PA_9,PA_8,PB_10,PB_5,PB_4,PB_3);
BusOut display2(PA_10, PA_9,PA_8,PB_10,PB_5,PB_4,PB_3);
DigitalOut SEL2(PC_7);
DigitalOut SEL1(PB_6);
DigitalIn BUTTON(PC_9);
static char i=0;

//deklaracija f-ja

//glavni program
void increment(void){
    switch(i){
        case 1: SEL1=1; display2=0xF9;break;
        case 2: display2=0xA4;break;
        case 3: display2=0xB0;break;
        case 4: display2=0x99;break;
        case 5: display2=0x92;break;
        case 6: display2=0x82;break;
        case 7: display2=0xF8;break;
        case 8: display2=0x80;break;
        case 9: display2=0x90;break;
        case 10: SEL2=1; SEL1=0; display1=0xF9; wait_ms(5); SEL1=1;display2=0x40;wait_ms(5);break;
        case 11: SEL2=1; SEL1=0; display1=0xF9; wait_ms(5); SEL1=1;display2=0xF9;wait_ms(5);break;
        case 12: SEL2=1; SEL1=0; display1=0xF9; wait_ms(5); SEL1=1;display2=0xA4;wait_ms(5);break;
        case 13: SEL2=1; SEL1=0; display1=0xF9; wait_ms(5); SEL1=1; display2=0xB0;wait_ms(5);break;
        case 14: SEL2=1; SEL1=0; display1=0xF9; wait_ms(5); SEL1=1; display2=0x99;wait_ms(5);break;
        case 15: SEL2=1; SEL1=0; display1=0xF9; wait_ms(5); SEL1=1; display2=0x92;wait_ms(5);break;
         
    
        }
    }

int main(){
    SEL1=1;
    SEL2=0;
    display2=0x40;
    while(1){
        if(BUTTON==0){
            i=i++;
            increment();
            wait_ms(200);
            }
            
        
        
        
        
        //SEL2=0;
        //display2=0x40;
    
        }
    }