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 "Flash.h" 00003 00004 BusOut display(LED1, LED2, LED3, LED4); 00005 InterruptIn cntUp(p5); 00006 Timer debounceUp; 00007 Flash flash; 00008 00009 char retainData[MEM_SIZE]; 00010 uint8_t counter; 00011 00012 void countUp(void) { 00013 if (debounceUp.read_ms() > 500) { 00014 00015 if (counter > 15) 00016 counter = 0; 00017 else 00018 counter++; 00019 00020 retainData[0] = counter; 00021 flash.writeFlash(retainData); 00022 00023 debounceUp.reset(); 00024 } 00025 } 00026 00027 int main() { 00028 cntUp.rise(&countUp); 00029 debounceUp.start(); 00030 00031 flash.readFlash(retainData); 00032 counter = retainData[0]; 00033 00034 while(1) { 00035 display = counter; 00036 } 00037 }
Generated on Wed Jul 13 2022 23:39:06 by
1.7.2