Sto 7. Lab 1 Zadatak 4 v2 Amer Šurković Haris Imamović

Dependencies:   mbed

Committer:
2016US_AmerSurkovic
Date:
Sun Mar 06 01:22:55 2016 +0000
Revision:
0:8325893f5e40
Sto 7. Lab 1 Zadatak 4 v2 Amer ?urkovi? Haris Imamovi?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
2016US_AmerSurkovic 0:8325893f5e40 1 #include "mbed.h"
2016US_AmerSurkovic 0:8325893f5e40 2 #define dp23 P0_0
2016US_AmerSurkovic 0:8325893f5e40 3
2016US_AmerSurkovic 0:8325893f5e40 4 BusOut disp(dp23,dp24, dp25, dp26, dp27, dp5, dp6, dp28);
2016US_AmerSurkovic 0:8325893f5e40 5 DigitalOut enable(dp14);
2016US_AmerSurkovic 0:8325893f5e40 6
2016US_AmerSurkovic 0:8325893f5e40 7 int stepen(int n) {
2016US_AmerSurkovic 0:8325893f5e40 8 int rez = 1;
2016US_AmerSurkovic 0:8325893f5e40 9 for(int i = 0; i < n; i++)
2016US_AmerSurkovic 0:8325893f5e40 10 rez *= 2;
2016US_AmerSurkovic 0:8325893f5e40 11
2016US_AmerSurkovic 0:8325893f5e40 12 return rez;
2016US_AmerSurkovic 0:8325893f5e40 13 }
2016US_AmerSurkovic 0:8325893f5e40 14
2016US_AmerSurkovic 0:8325893f5e40 15 int main() {
2016US_AmerSurkovic 0:8325893f5e40 16 enable = 0;
2016US_AmerSurkovic 0:8325893f5e40 17 disp = 0;
2016US_AmerSurkovic 0:8325893f5e40 18 int counter = 0;
2016US_AmerSurkovic 0:8325893f5e40 19
2016US_AmerSurkovic 0:8325893f5e40 20 while(1) {
2016US_AmerSurkovic 0:8325893f5e40 21
2016US_AmerSurkovic 0:8325893f5e40 22 if(counter == 9) {
2016US_AmerSurkovic 0:8325893f5e40 23 counter = 0;
2016US_AmerSurkovic 0:8325893f5e40 24 disp = 0;
2016US_AmerSurkovic 0:8325893f5e40 25 }
2016US_AmerSurkovic 0:8325893f5e40 26 else disp = stepen(counter);
2016US_AmerSurkovic 0:8325893f5e40 27
2016US_AmerSurkovic 0:8325893f5e40 28 wait(0.2);
2016US_AmerSurkovic 0:8325893f5e40 29 counter++;
2016US_AmerSurkovic 0:8325893f5e40 30 }
2016US_AmerSurkovic 0:8325893f5e40 31 }