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 BusOut leds(dp23, dp24, dp25, dp26, dp27, dp5, dp6, dp28); 00004 DigitalOut enable(dp14); 00005 DigitalIn taster1(dp1); 00006 DigitalIn taster2(dp2); 00007 00008 bool pressed1() 00009 { 00010 int j = 0; 00011 while(taster1) 00012 { 00013 j++; 00014 if(j > 1000) 00015 { 00016 return true; 00017 } 00018 } 00019 j = 0; 00020 return false; 00021 } 00022 00023 bool pressed2() 00024 { 00025 int j = 0; 00026 while(taster2) 00027 { 00028 j++; 00029 if(j > 1000) 00030 { 00031 return true; 00032 } 00033 } 00034 j = 0; 00035 return false; 00036 } 00037 00038 int main() { 00039 enable = 0; 00040 leds = 0; 00041 int i = 0; 00042 while(1) { 00043 if(pressed1()) 00044 { 00045 if(i == 256) 00046 { 00047 i = 0; 00048 } 00049 i++; 00050 leds = i; 00051 while(taster1){} 00052 00053 } 00054 if(pressed2()) 00055 { 00056 if(i == 0) 00057 { 00058 i = 257; 00059 } 00060 i--; 00061 leds = i; 00062 while(taster2) {} 00063 } 00064 00065 } 00066 }
Generated on Mon Aug 1 2022 20:05:48 by
1.7.2