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 "TextLCD.h" 00003 #include "DebouncedIn.h" 00004 00005 BusOut led(LED4, LED3, LED2, LED1); 00006 unsigned char i; 00007 TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7 00008 DebouncedIn setbutton(p5); 00009 00010 int main() { 00011 int state; 00012 state = 0; 00013 i = 0; 00014 while(1) { 00015 if (setbutton.rising()) { 00016 state = !state; 00017 } 00018 if (state == 0) { 00019 lcd.printf("Binary: %u\n", i); 00020 led = i; 00021 } 00022 else if (state == 1) { 00023 lcd.printf("Graycode: %u\n", i); 00024 led = i^(i>>1); 00025 } 00026 wait(1); 00027 i = i+1; 00028 if (i == 16) { 00029 i = 0; 00030 } 00031 lcd.cls(); 00032 } 00033 }
Generated on Wed Jul 13 2022 12:41:00 by
1.7.2