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 #include "ShiftOut.h" 00003 00004 ShiftOut Seg7(D8, D7, D4, D13, D12); 00005 00006 const char SEGMENT_MAP[] = {0x03,0x9F,0x25,0x0D,0x99,0x49,0x41,0x1F,0x01,0x09}; 00007 const char SEGMENT_SELECT[] = {0x8F,0x4F,0x2F,0x1F}; 00008 00009 int counter = 0; 00010 00011 int main() { 00012 while(1) { 00013 for (int delay = 0 ; delay < 100 ; delay++) { 00014 Seg7.write2Byte(SEGMENT_MAP[counter/1000] + (SEGMENT_SELECT[0]<<8)); 00015 Seg7.write2Byte(SEGMENT_MAP[counter%1000/100] + (SEGMENT_SELECT[1]<<8)); 00016 Seg7.write2Byte(SEGMENT_MAP[counter%100/10] + (SEGMENT_SELECT[2]<<8)); 00017 Seg7.write2Byte(SEGMENT_MAP[counter%10] + (SEGMENT_SELECT[3]<<8)); 00018 } 00019 if (counter < 9999) { 00020 counter++; 00021 } else { 00022 counter = 0; 00023 } 00024 } 00025 }
Generated on Tue Jul 12 2022 17:26:08 by
 1.7.2
 1.7.2