![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
2020/0438 Mihajlo Djordjevic
main.cpp
- Committer:
- mixidj
- Date:
- 2021-11-06
- Revision:
- 0:99f9461c6a51
File content as of revision 0:99f9461c6a51:
// 2020/0438 Mihajlo Djordjevic // Biblioteke #include "mbed.h" // 0001 0010 // Makro #define PWM_PERIOD 20 #define AKTIVAN 0 #define NULA 0x40 #define JEDAN 0xF9 #define DVA 0x24 #define TRI 0x30 #define CETRI 0x19 #define PET 0x12 #define SEST 0x02 #define SEDAM 0xF8 #define OSAM 0x00 #define DEVET 0x10 // Glavne promenljive BusOut display(PA_10,PA_9,PA_8,PB_10,PB_5,PB_4,PB_3); DigitalOut aktivan1(PC_7); DigitalOut aktivan2(PB_6); DigitalIn button(PC_9); // Funkcije int main() { int i = 0; static char pusten = 0; while(1) { aktivan1.write(AKTIVAN); aktivan2.write(1); display.write(NULA); if(!button) { // ako drzite dugme prikazace se cifre 1 - 9 switch(i) { case 0: display.write(NULA); case 1: display.write(JEDAN); break; case 2: display.write(DVA); break; case 3: display.write(TRI); break; case 4: display.write(CETRI); break; case 5: display.write(PET); break; case 6: display.write(SEST); break; case 7: display.write(SEDAM); break; case 8: display.write(OSAM); break; case 9: display.write(DEVET); break; } i++; if(i == 10) i = -1; wait(1); /*if(pusten) { Nikako nisam mogao da udjem u ovu petlju i++; switch(i) { case 0: aktivan1.write(AKTIVAN); display.write(NULA); case 1: aktivan1.write(AKTIVAN); display.write(JEDAN); break; case 2: aktivan1.write(AKTIVAN); display.write(DVA); break; case 3: aktivan1.write(AKTIVAN); display.write(TRI); break; case 4: aktivan1.write(AKTIVAN); display.write(CETRI); break; case 5: aktivan1.write(AKTIVAN); display.write(PET); break; case 6: aktivan1.write(AKTIVAN); display.write(SEST); break; case 7: aktivan1.write(AKTIVAN); display.write(SEDAM); break; case 8: aktivan1.write(AKTIVAN); display.write(OSAM); break; case 9: aktivan1.write(AKTIVAN); display.write(DEVET); break; } i++; if(i == 10) i = -1; wait(1); pusten = 0; }*/ } else { i = 0; pusten = 1; } } }