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.
main.cpp
00001 #include "mbed.h" 00002 00003 00004 #define dp23 P0_0 00005 DigitalOut enable(dp14); 00006 00007 00008 BusOut cifre(dp26,dp27,dp5,dp6,dp28,dp4,dp18,dp17), brReda(dp23,dp24,dp25); 00009 DigitalIn taster1(dp1),taster2(dp2); 00010 00011 00012 int cifreBroja[10] = {64,121,36,48,25,18,2,120,0,16}; 00013 00014 int brojac = 0; 00015 00016 void smanji() { brojac--; if(brojac < 0) brojac = 0; } 00017 void povecaj() { brojac++; if (brojac > 999) brojac = 999; } 00018 00019 int main() { 00020 enable = 0; 00021 bool jednoPritisnuto = false; 00022 00023 while(1) { 00024 while(taster1) 00025 { 00026 if(jednoPritisnuto == false) 00027 { 00028 povecaj(); 00029 jednoPritisnuto = true; 00030 } 00031 } 00032 while(taster2) 00033 { 00034 if(jednoPritisnuto == false) 00035 { 00036 smanji(); 00037 jednoPritisnuto = true; 00038 } 00039 } 00040 jednoPritisnuto = false; 00041 00042 00043 int cifra1 = brojac % 10, cifra2 = (brojac/10) % 10, cifra3 = (brojac/100) %10; 00044 00045 brReda = 6; 00046 cifre = cifreBroja[cifra3] - 128; 00047 wait(0.005); 00048 00049 brReda = 5; 00050 cifre = cifreBroja[cifra2] - 128; 00051 wait(0.005); 00052 00053 00054 brReda = 3; 00055 cifre = cifreBroja[cifra1] - 128; 00056 wait(0.005); 00057 } 00058 }
Generated on Tue Aug 9 2022 15:01:15 by
