Marko_Marinic_0246048959
Dependencies: mbed SeeedShieldBot TextLCD BluetoothSerial
Diff: SegDisplay.cpp
- Revision:
- 0:0b3b22a12941
diff -r 000000000000 -r 0b3b22a12941 SegDisplay.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SegDisplay.cpp Tue Jul 13 15:31:59 2021 +0000 @@ -0,0 +1,21 @@ +#include "SegDisplay.h" +BusOut Seg(D2,D3,D4,D5,D6,D7,D8,D9); +void SegInit(void) { +Seg=SegConvert(0); +} +char SegConvert(char SegValue) { +char SegByte=0x00; +switch (SegValue) { //DP G F E D C B A +case 0 : SegByte = 0x3F; break; // 0 0 1 1 1 1 1 1 binary +case 1 : SegByte = 0x06; break; // 0 0 0 0 0 1 1 0 binary +case 2 : SegByte = 0x5B; break; // 0 1 0 1 1 0 1 1 binary +case 3 : SegByte = 0x4F; break; // 0 1 0 0 1 1 1 1 binary +case 4 : SegByte = 0x66; break; // 0 1 1 0 0 1 1 0 binary +case 5 : SegByte = 0x6D; break; // 0 1 1 0 1 1 0 1 binary +case 6 : SegByte = 0x7D; break; // 0 1 1 1 1 1 0 1 binary +case 7 : SegByte = 0x07; break; // 0 0 0 0 0 1 1 1 binary +case 8 : SegByte = 0x7F; break; // 0 1 1 1 1 1 1 1 binary +case 9 : SegByte = 0x6F; break; // 0 1 1 0 1 1 1 1 binary +} +return SegByte; +} \ No newline at end of file