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: main1.txt
- Revision:
- 0:ee7ec177de7e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main1.txt Mon Jan 17 15:59:40 2022 +0000
@@ -0,0 +1,63 @@
+//Include
+#include "mbed.h"
+#include "platform/mbed_thread.h"
+
+//Definisanje
+#define TIME_DELAY 3
+#define BUTTON_PRESSED_DELAY 300
+
+//0110 0000
+
+//Deklaracija promenjivih
+DigitalOut SEL1(PB_6), SEL2(PC_7);
+DigitalIn SW1(PC_9);
+BusOut display1(PA_10, PA_9, PA_8, PB_10, PB_5, PB_4, PB_3, PB_6);
+BusOut display2(PA_10, PA_9, PA_8, PB_10, PB_5, PB_4, PB_3, PC_7);
+
+int NUMBERS[10] = {0x40, 0x79, 0x24, 0x30, 0x19, 0x12, 0x02, 0x78, 0x00, 0x10};
+
+int a = 0;
+
+//Deklaracija funkcije koja pokazuje broj
+void showNumber(int a);
+
+
+//Glavni program
+int main()
+{
+ while(true){
+ if(SW1 == 0){
+ a++;
+ if( a == 11)
+ a = 0;
+ wait_ms(BUTTON_PRESSED_DELAY);
+ }
+
+ showNumber(a);
+ wait_ns(TIME_DELAY);
+ }
+}
+
+void showNumber(int a){
+ if(a <= 9 ){
+ SEL2 = 1;
+ display1 = NUMBERS[a];
+ }
+
+ if( a == 10 ){
+ display1 = NUMBERS[1];
+ wait_ns(TIME_DELAY);
+
+ SEL1 = 1;
+
+ wait_ns(TIME_DELAY);
+
+ display2 = NUMBERS[0];
+ wait_ns(TIME_DELAY);
+
+ SEL2 = 1;
+
+ wait_ns(TIME_DELAY);
+ }
+
+}
\ No newline at end of file