Created
July 9, 2019 02:05
-
-
Save surinoel/84c3b14e49e259c21782509f677c7c1a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint8_t aFndData[16] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x27, | |
0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71}; | |
uint8_t aFndSelData[6] = {0x3E, 0x3D, 0x3B, 0x37, 0x2F, 0x1F}; | |
int aPinFndData[8] = {13, 12, 11, 10, 9, 8, 7, 6}; | |
int aPinFndSel[6] = {5, 4, 3, 2, 1, 0}; | |
void setup() { | |
// put your setup code here, to run once: | |
for(int i=0; i<8; i++) { | |
pinMode(aPinFndData[i], OUTPUT); | |
} | |
for(int i=0; i<6; i++) { | |
pinMode(aPinFndSel[i], OUTPUT); | |
} | |
} | |
void loop() { | |
int aFndNum[6] = {0, 1, 3, 5, 7, 9}; | |
for(int k=0; k<6; k++) { | |
fndSelOut(aFndSelData[k]); | |
fndDataOut(aFndData[aFndNum[k]]); | |
delay(2); | |
} | |
} | |
void fndDataOut(uint8_t data) { | |
for(int i=0; i<8; i++) { | |
digitalWrite(aPinFndData[i], (data >> i) & 0x01); | |
} | |
} | |
void fndSelOut(uint8_t data) { | |
for(int i=0; i<6; i++) { | |
digitalWrite(aPinFndSel[i], (data >> i) & 0x01); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment