Skip to content

Raw function for the 7 segment. #32

@HubKing

Description

@HubKing

raspberrypi-examples/actor-led-7segment-4numbers/

It lacks a function to write raw things like a minus symbol or H or etc. I created one.

#Lights up each segment in order.
Display.Show1Raw(3, [0,0,0,  0,0,0,0])
sleep(2);
Display.Show1Raw(3, [0,0,0,  0,0,0,1])
sleep(2);
Display.Show1Raw(3, [0,0,0,  0,0,1,0])
sleep(2);
Display.Show1Raw(3, [0,0,0,  0,1,0,0])
sleep(2);
Display.Show1Raw(3, [0,0,0,  1,0,0,0])
sleep(2);
Display.Show1Raw(3, [0,0,1,  0,0,0,0])
sleep(2);
Display.Show1Raw(3, [0,1,0,  0,0,0,0])
sleep(2);
Display.Show1Raw(3, [1,0,0,  0,0,0,0])
sleep(2);

    def Show1Raw(self, DigitNumber, data):
        """show one Digit (number 0...3)"""
        if(DigitNumber < 0 or DigitNumber > 3):
            return  # error

        byte = 0 
        for i in range(0, 7):
            byte  += data[i] * 2**(6-i)

        self.start()
        self.writeByte(ADDR_FIXED)
        self.br()
        self.writeByte(STARTADDR | DigitNumber)
        self.writeByte(byte)
        self.br()
        self.writeByte(0x88 + int(self.__brightness))
        self.stop()  

Also, the methods have no comments. Difficult to know what they are doing...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions