I combined the 7 Segment display of the Raspberry Pi and the 8 Arduino LED 13 code. I tightened up the code. This one uses the LSB logic table below.