Hisyam Sulaiman
/
lab2_part6inc
increment
main.cpp
- Committer:
- HisyamSulaiman
- Date:
- 2018-05-24
- Revision:
- 0:c1fb90b1352b
File content as of revision 0:c1fb90b1352b:
#include "mbed.h" DigitalIn button(D4); BusOut seg(D7,D8,D9,D10,D11,D12,D13); char SegConvert(char SegValue); int main() { while(1) { for (char i=0;i<10; button==1&&i++) { seg=SegConvert(i); wait(1); } } } char SegConvert(char SegValue){ char SegByte=0x00; switch(SegValue) { case 0 : SegByte = 16;break; case 1 : SegByte = 0;break; case 2 : SegByte = 120;break; case 3 : SegByte = 2;break; case 4 : SegByte = 18;break; case 5 : SegByte = 25;break; case 6 : SegByte = 48;break; case 7 : SegByte = 36;break; case 8 : SegByte = 121;break; case 9 : SegByte = 64;break; } return SegByte; }