Paul suggested an alternate solution, namely to turn off LEDs by setting them to high impedance instead of 0V. That way the tiny LED capacitances have no way to charge and thus no ghosting. I tried it and it works! Awesome "zero extra components" solution, fixing it in software.
Here's the relevant change to the sketch that does just that:
// turn off all LEDs by turning them to HiZ
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
pinMode(A5, INPUT);
// Turn on required LEDs
if (mask[pattern] & 0x01) { pinMode(A0, OUTPUT); digitalWrite(A0, HIGH); }
if (mask[pattern] & 0x02) { pinMode(A1, OUTPUT); digitalWrite(A1, HIGH); }
if (mask[pattern] & 0x04) { pinMode(A2, OUTPUT); digitalWrite(A2, HIGH); }
if (mask[pattern] & 0x08) { pinMode(A3, OUTPUT); digitalWrite(A3, HIGH); }
if (mask[pattern] & 0x10) { pinMode(A4, OUTPUT); digitalWrite(A4, HIGH); }
if (mask[pattern] & 0x20) { pinMode(A5, OUTPUT); digitalWrite(A5, HIGH); }
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.