GPIO Joy Seven Segment Display
A seven segment display is a set of LEDs arranged in the familiar ‘digital clock’ pattern. Seven segment displays are often arranged in arrays so you can control multiple digits with fewer pins.
For example, you can control a single digit seven segment display with 9 pins. One pin for each of the seven segments, one for the decimal point, and one to enable or disable the digit. You can control a pair of displays with only 10 pins, where the segment and decimal LEDs are wired to shared pins, and each display has its own enable / disable pin.
In the example below, a three digit seven segment display is configured. The digit pins are 11,13, and 15. The segment pins are at the bottom of the header from 29 – 40. This display is a common cathode type, so notice the negative numbers used in the <Digits> element. The display will show the value of the XBox right stick from -99 to 99 at the minimum and maximum ends of its range.
<GpioConfig>
<PinModes>
<!-- Digit Pins -->
<Pin>
<Number>11</Number>
<Mode>Output</Mode>
</Pin>
<Pin>
<Number>13</Number>
<Mode>Output</Mode>
</Pin>
<Pin>
<Number>15</Number>
<Mode>Output</Mode>
</Pin>
<!-- Segment Pins-->
<Pin>
<Number>29</Number>
<Mode>Output</Mode>
</Pin>
<Pin>
<Number>31</Number>
<Mode>Output</Mode>
</Pin>
<Pin>
<Number>33</Number>
<Mode>Output</Mode>
</Pin>
<Pin>
<Number>35</Number>
<Mode>Output</Mode>
</Pin>
<Pin>
<Number>36</Number>
<Mode>Output</Mode>
</Pin>
<Pin>
<Number>37</Number>
<Mode>Output</Mode>
</Pin>
<Pin>
<Number>38</Number>
<Mode>Output</Mode>
</Pin>
<Pin>
<Number>40</Number>
<Mode>Output</Mode>
</Pin>
</PinModes>
<SevenSegDisplays>
<SevenSegDisplay>
<Name>Display</Name>
<SegPins>33,29,36,38,40,31,35,37</SegPins>
<Digits>-11,-13,-15</Digits>
<Joystick direction="1">RightStickUp</Joystick>
<Joystick direction="-1">RightStickDown</Joystick>
</SevenSegDisplay>
</SevenSegDisplays>
</GpioConfig>