Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:f47d9cc84f81
- Child:
- 1:fc4f81779ab2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Nov 06 08:15:23 2021 +0000 @@ -0,0 +1,94 @@ +/*Uvoz biblioteka #include*/ +#include "mbed.h" + +/*Definisanje direktiva #define*/ + +/*Definisanje glavnih promenljivih*/ +DigitalIn SW1(PC_9); +DigitalOut SEL1 (PB_6); +DigitalOut SEL2 (PC_7); +BusOut displej(PA_10, PA_9, PA_8, PB_10, PB_5, PB_4, PB_3, PB_6, PC_7); +int brojac = 0; + +/*Pisanje glavne funkcije main*/ +int main() +{ + while (true) + { + if (SW1 == 0) + { + brojac += 1; + wait_ms(500); + } + if (brojac == 0) + { + SEL1.write(0); + displej.write(0xC0); //0 na desnom sedmosegmentnom displeju + } + if (brojac == 1) + { + SEL1.write(0); + displej.write(0x79); //1 na desnom sedmosegmentnom displeju + } + if (brojac == 2) + { + SEL1.write(0); + displej.write(0x24); //2 na desnom sedmosegmentnom displeju + } + if (brojac == 3) + { + SEL1.write(0); + displej.write(0x30); //3 na desnom sedmosegmentnom displeju + } + if (brojac == 4) + { + SEL1.write(0); + displej.write(0x19); //4 na desnom sedmosegmentnom displeju + } + if (brojac == 5) + { + SEL1.write(0); + displej.write(0x12); //5 na desnom sedmosegmentnom displeju + } + if (brojac == 6) + { + SEL1.write(0); + displej.write(0x2); //6 na desnom sedmosegmentnom displeju + } + if (brojac == 7) + { + SEL1.write(0); + displej.write(0x78); //7 na desnom sedmosegmentnom displeju + } + if (brojac == 8) + { + SEL1.write(0); + displej.write(0x0); //8 na desnom sedmosegmentnom displeju + } + if (brojac == 9) + { + SEL1.write(0); + displej.write(0x10); //9 na desnom sedmosegmentnom displeju + } + if (brojac == 10) + { + //SEL1.write(0x79); //1 na levom sedmosegmentnom displeju + //displej.write(0x10); //0 na desnom sedmosegmentnom displeju + } + if (brojac>=15) + brojac = 0; + } +} +/*komentar +0x3F, 0xC0 //0111111 NULA +0x06, 0x79 //0000110 JEDAN +0x5B, 0x24 //1011011 DVA +0x4F, 0x30 //1001111 TRI +0x66, 0x19 //1100110 CETIRI +0x6D, 0x12 //1101101 PET +0x7D, 0x2 //1111101 SEST +0x07, 0x78 //0000111 SEDAM +0x7F, 0x0 //1111111 OSAM +0x6F, 0x10 //1101111 DEVET +0x00 0x7F //0000000 UGASI +*/ \ No newline at end of file