use the PortInOut class to make a key_controlled counter
Dependencies: mbed
Fork of PortInOut_HelloWorld by
main.cpp
00001 /************************************************* 00002 *file:time counter 00003 *creator:JacobShi 00004 *Time:2014/10/16 00005 * Description: uses the portInOut to make a keycrolled couter 00006 **************************************************/ 00007 #include "mbed.h" 00008 char data[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90}; 00009 PortInOut lednumber(Port0,0x000000ff); 00010 PortInOut keycontrol(Port1,0x00000001); 00011 int i=0; 00012 int main() { 00013 lednumber.output(); 00014 keycontrol.input(); 00015 while(1) 00016 { 00017 if(!keycontrol) 00018 { 00019 wait_ms(10); 00020 if(!keycontrol) 00021 { 00022 while(!keycontrol); 00023 lednumber=data[i]; 00024 (i++)%10; 00025 } 00026 00027 } 00028 00029 } 00030 }
Generated on Fri Jul 15 2022 14:04:05 by 1.7.2