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 "C12832.h" 00003 00004 00005 InterruptIn joystickcenter(p14); 00006 InterruptIn button(p9); 00007 DigitalOut led(LED1); 00008 DigitalOut flash(LED4); 00009 C12832 lcd(p5, p7, p6, p8, p11); 00010 Timer debounce; 00011 int i = 0; 00012 00013 void flip() 00014 { 00015 if( debounce.read_ms() > 100) // will accept next push button at least 100ms from last press, avoiding bouncing switch effect 00016 { 00017 led=!led; 00018 i = 1; 00019 debounce.reset(); 00020 } 00021 } 00022 00023 00024 int main() 00025 { 00026 joystickcenter.rise(&flip); 00027 button.mode(PullUp); 00028 button.rise(&flip); 00029 debounce.start(); 00030 00031 while (1) { 00032 flash = !flash; 00033 if(i==1) { 00034 lcd.printf("BANG! "); //keep printf outside interrupt - better as the interrupt needs to be as short as possible 00035 i = 0; 00036 } 00037 wait(0.25); 00038 } 00039 }
Generated on Mon Jul 18 2022 09:27:06 by
1.7.2