![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Pavle Popovic 2020/0494
Dependencies: Adafruit_GFX 19E042PIM_MB_PINS
Diff: main1.txt
- Revision:
- 0:4b068ef5ed41
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main1.txt Mon Jan 17 16:05:55 2022 +0000 @@ -0,0 +1,53 @@ +#include "mbed.h"//uvoz biblioteka + +#define MBED_RAM_SIZE//definisanje direktiva + +DigitalOut led(LED1); +BusOut display(PA_10,PA_9,PA_8,PB_10,PB_5,PB_4,PB_3,PA_5);//glavne promenljive +DigitalOut SEL2(PC_7); +DigitalOut SEL1(PB_6); +DigitalIn SW1(PC_9); + +int main() +{ + int x=1; + int i=0; + while (true) + { + if(i<11) + { + if(!SW1) + { + if(x){ + i=i+1; + x=0; + } + } + else + { + x=1; + } + wait_us(500); + SEL1.write(1); + SEL2.write(1); + switch(i) + { + case 0:SEL2.write(0);display.write(0xC0);wait_us(500);SEL2.write(1);break; + case 1:SEL2.write(0);display.write(0xF9);wait_us(500);SEL2.write(1);break; + case 2:SEL2.write(0);display.write(0xA4);wait_us(500);SEL2.write(1);break; + case 3:SEL2.write(0);display.write(0xB0);wait_us(500);SEL2.write(1);break; + case 4:SEL2.write(0);display.write(0x99);wait_us(500);SEL2.write(1);break; + case 5:SEL2.write(0);display.write(0x92);wait_us(500);SEL2.write(1);break; + case 6:SEL2.write(0);display.write(0x82);wait_us(500);SEL2.write(1);break; + case 7:SEL2.write(0);display.write(0xF8);wait_us(500);SEL2.write(1);break; + case 8:SEL2.write(0);display.write(0x80);wait_us(500);SEL2.write(1);break; + case 9:SEL2.write(0);display.write(0x90);wait_us(500);SEL2.write(1);break; + case 10:SEL1.write(0);display.write(0xF9);wait_us(500);SEL1.write(1);SEL2.write(0);display.write(0xC0);wait_us(500);SEL2.write(1);break; + } + } + else + { + i=0; + } + } +} \ No newline at end of file