Added Code/led.py

This commit is contained in:
= 2020-08-06 11:20:17 -04:00
parent ad499e29b1
commit 94be330cf6

29
Code/led.py Normal file
View file

@ -0,0 +1,29 @@
def askQuestion():
while True:
col = int(input("Column [0-31]: "))
if col <= 31 and col >= 0:
break
else:
print("Column Number Must be Between 0 and 31")
while True:
row = int(input("Row [0-7]: "))
if row <= 7 and row >= 0:
break
else:
print("Row Number Must be Between 0 and 7")
print("LED Number: " + str(getLedNumber(col, row)))
def getLedNumber(column, row):
pcbNum = int(column / 2)
colNum = column % 2
if colNum == 0:
return ((7-row) + (pcbNum * 16))
else:
return ((8 + row) + (pcbNum * 16))
if __name__ == "__main__":
askQuestion()