2
\$\begingroup\$

I was going through the tutorial in https://www.101computing.net/bbc-microbit-counter-using-a-7-segment-display/ using a 7-segment display I got from an electronics shop about 10 years ago. Everything works except that the signals are inverted.

When I output 0, LEDs switch on and when I output 1, the LEDS switch off.

I'm just wondering whether I've got a wiring error somewhere or whether there are two types of 7-segment displays - ones where 1s switch on the display and ones where 0s switch on the display.

\$\endgroup\$
3
  • \$\begingroup\$ It's a DED (Dark Emitting Display) \$\endgroup\$ Jan 16 at 0:18
  • \$\begingroup\$ no big deal ... just reverse the bit mappings in the code \$\endgroup\$
    – jsotola
    Jan 16 at 2:38
  • \$\begingroup\$ That is what I did when I realized what was happening. It is one of those cases where I fixed the symptom but didn't know the root reason of why it worked. Anyway @sphero has provided the answer. \$\endgroup\$
    – cup
    Jan 16 at 8:50

1 Answer 1

4
\$\begingroup\$

The tutorial calls for a common-anode display. The common is connected to Vdd.

When you output a 0 the LED segment should turn on, and when you output a 1 it should turn off. So it is doing the expected thing. Image from here

enter image description here

With a common-cathode display, the common would typically be grounded, and a high input (with a series resistor) would cause the LED to turn on.

There are various reasons to prefer one type over the other, mostly to do with the relative strength of drivers used. Usually, I find common-anode is preferable.

\$\endgroup\$
1
  • \$\begingroup\$ P.S. if you replace the line "pins[j].write_digital(int(bits[j]))" with "pins[j].write_digital(1-int(bits[j]))" it should work. \$\endgroup\$ Jan 16 at 3:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.