Good spot, thanks.
Huh?
Updated code:
const byte segPattern[10] = {
//abcdefg
0b1111110, //0
0b0110000, //1
0b1101101, //2
0b1111001, //3
0b0110011, //4
0b1011011, //5
0b1011111, //6 with a "tail"
0b1110000, //7
0b1111111, //8
0b1111011 //9 with a "tail"
};
void setup() {
Serial.begin(115200);
//test every possible combination of 7 segments
for (byte segCombo = 0b0000000; segCombo <= 0b1111111; segCombo++) {
bool duplicateFound = false;
//test each decimal digit
for (byte digit = 0; digit <= 9; digit++) {
//check the resulting pattern has not already been seen
for (byte testDigit = 0; testDigit < digit; testDigit++) {
if ((segPattern[testDigit] & segCombo) == (segPattern[digit] & segCombo)) duplicateFound = true;
}
}
if (!duplicateFound) {
Serial.print("Segment combination ");
for (char s = 6; s >= 0; s--) {
if (bitRead(segCombo, s) == 1) Serial.print((char) ('g' - s));
}
Serial.println(" could be used");
}
}
}
void loop() {
}
Results for 6 and 9 both having "tails":
Segment combination abefg could be used
Segment combination abdefg could be used
Segment combination abcefg could be used
Segment combination abcdefg could be used
Results for 6 with no tail and 9 with tail:
Segment combination abefg could be used
Segment combination abdefg could be used
Segment combination abcefg could be used
Segment combination abcdefg could be used
Results for 6 with tail and 9 with no tail:
Segment combination abefg could be used
Segment combination abdefg could be used
Segment combination abcefg could be used
Segment combination abcdeg could be used
Segment combination abcdefg could be used
Results for 6 with no tail and 9 with no tail:
Segment combination adefg could be used
Segment combination acdefg could be used
Segment combination abefg could be used
Segment combination abdefg could be used
Segment combination abcefg could be used
Segment combination abcdfg could be used
Segment combination abcdeg could be used
Segment combination abcdefg could be used
So the segment combination abefg seems to be enough to distinguish digits 0 to 9 regardless of the tails/no tails for 6 and 9.
//abefg
0b11110, //0
0b01000, //1
0b11101, //2
0b11001, //3
0b01011, //4
0b10011, //5
0b10111, //6 with a tail
0b00111, //6 with no tail
0b11000, //7
0b11111, //8
0b11011 //9 with a tail or no tail (tail is seg d)
Hopefully I got it right this time!
@CoJammer I hope this is useful for you!