Seven Segment Display

Published by christos Merinopoulos in

Create a function that takes a single Hexadecimal number as an argument and returns the equivalent six-digit binary number to light the display. Consider the six-digit binary number as an incoming input from a serial port. The segment display is a common cathode segment display that means you need to give a logical 1 to light up each segment.

Alternative Text

Examples

toDisplay('1') ➞ 0x06

toDisplay('8') ➞ 0x7F

toDisplay('0') ➞ 0x3F

Notes

  • The segment display is a common cathode segment display that means you need to give (5v logical 1) to light up each segment.
  • Expect an input from 0-9.
  • LSB starts from a, b, c.
Watch a quick demo on how Edabit works.