use the PortInOut class to make a key_controlled counter
Dependencies: mbed
Fork of PortInOut_HelloWorld by
main.cpp
- Committer:
- shiyilei
- Date:
- 2014-10-17
- Revision:
- 2:7e1bc5947174
- Parent:
- 0:018ca8a43b33
File content as of revision 2:7e1bc5947174:
/************************************************* *file:time counter *creator:JacobShi *Time:2014/10/16 * Description: uses the portInOut to make a keycrolled couter **************************************************/ #include "mbed.h" char data[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90}; PortInOut lednumber(Port0,0x000000ff); PortInOut keycontrol(Port1,0x00000001); int i=0; int main() { lednumber.output(); keycontrol.input(); while(1) { if(!keycontrol) { wait_ms(10); if(!keycontrol) { while(!keycontrol); lednumber=data[i]; (i++)%10; } } } }