wiremod 7 segments display codec

@name 7segments counter
@inputs Digit
@outputs A B C D E F G
@trigger 

Digit = int(Digit % 10)

if (Digit == 0) {
    A = 1
    B = 1
    C = 1
    D = 1
    E = 1
    F = 1
    G = 0
} elseif (Digit == 1) {
    A = 0
    B = 1
    C = 1
    D = 0
    E = 0
    F = 0
    G = 0
} elseif (Digit == 2) {
    A = 1
    B = 1
    C = 0
    D = 1
    E = 1
    F = 0
    G = 1
} elseif (Digit == 3) {
    A = 1
    B = 1
    C = 1
    D = 1
    E = 0
    F = 0
    G = 1
} elseif (Digit == 4) {
    A = 0
    B = 1
    C = 1
    D = 0
    E = 0
    F = 1
    G = 1
} elseif (Digit == 5) {
    A = 1
    B = 0
    C = 1
    D = 1
    E = 0
    F = 2
    G = 1
} elseif (Digit == 6) {
    A = 1
    B = 0
    C = 1
    D = 1
    E = 1
    F = 1
    G = 1
} elseif (Digit == 7) {
    A = 1
    B = 1
    C = 1
    D = 0
    E = 0
    F = 1
    G = 0
} elseif (Digit == 8) {
    A = 1
    B = 1
    C = 1
    D = 1
    E = 1
    F = 1
    G = 1
} elseif (Digit == 9) {
    A = 1
    B = 1
    C = 1
    D = 1
    E = 0
    F = 1
    G = 1
}

kjwon15

I'm a hacker, I want to improve life.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.