#!/user/bin/python3
import RPi.GPIO as GPIO #GPIO Library
import time #time library for timing the light.
GPIO.setwarnings(False) #Get rid of bunk message
GPIO.setmode(GPIO.BCM) #Sets pin number format to GPIO
binaryLight= [26, 19, 13, 6, 5, 22, 27, 17] #A list of using pin using.
GPIO.setup(binaryLight, GPIO.OUT) #You well the computer to pin the outputs
GPIO.output(binaryLight, True) #The lights turn on
time.sleep(10) #Wait 10 seconds
GPIO.output(binaryLight, False) #You turn all the lights off
while True: #A loop that keeps running
for digit in range(0, 256): #A range from 0 to 256 and in a for loop
print(digit) #Print the digit which is the variable
digibini = "{0:b}".format(digit) #Variable that formats the digits
if len(digibini) == 7: #if statement that shows the length of 7
digibini = "0" + digibini #The amount of 0 in the binary is one 0
if len(digibini) == 6: #if statement that shows the length of 6
digibini = "00" + digibini #The amount of 0 in the binary is two 0's
if len(digibini) == 5: #if statement that shows the length of 5
digibini = "000" + digibini #The amount of 0 in the binary is three 0's
if len(digibini) == 4: #if statement that shows the length of 4
digibini = "0000" + digibini #The amount of 0 in the binary is four 0's
if len(digibini) == 3: #if statement that shows the length of 3
digibini = "00000" + digibini #The amount of 0 in the binary is five 0's
if len(digibini) == 2: #if statement that shows the length of 2
digibini = "000000" + digibini #The amount of 0 in the binary is six 0's
if len(digibini) == 1: #if statement that shows the length of 1
digibini = "0000000" + digibini #The amount of 0 in the binary is seven 0's
print(digibini) #Print statement for the variable digibini
if digibini[7] =='1': #if statement of digibini for 7
GPIO.output(26, True) #True statement of GPIO output for the number 26
else: #Else statement for the if statement above which shows if the if statement is not wrking than the statement below should work
GPIO.output(26, False) #False statement of GPIO output for the number 26
if digibini[6] =='1': #if statement of digibini for 6
GPIO.output(19, True) #True statement of GPIO output for the number 19
else: #Else statement for the if statement above which shows if the if statement is not wrking than the statement below should work
GPIO.output(19, False) #False statement of GPIO output for the number 19
if digibini[5] =='1': #if statement of digibini for 5
GPIO.output(13, True) #True statement of GPIO output for the number 13
else: #Else statement for the if statement above which shows if the if statement is not wrking than the statement below should work
GPIO.output(13, False) #False statement of GPIO output for the number 13
if digibini[4] =='1': #if statement of digibini for 4
GPIO.output(6, True) #True statement of GPIO output for the number 6
else: #Else statement for the if statement above which shows if the if statement is not wrking than the statement below should work
GPIO.output(6, False) #False statement of GPIO output for the number 6
if digibini[3] =='1': #if statement of digibini for 3
GPIO.output(5, True) #True statement of GPIO output for the number 5
else: #Else statement for the if statement above which shows if the if statement is not wrking than the statement below should work
GPIO.output(5, False) #False statement of GPIO output for the number 5
if digibini[2] =='1': #if statement of digibini for 2
GPIO.output(22, True) #True statement of GPIO output for the number 22
else: #Else statement for the if statement above which shows if the if statement is not wrking than the statement below should work
GPIO.output(22, False) #False statement of GPIO output for the number 22
if digibini[1] =='1': #if statement of digibini for 1
GPIO.output(27, True) #True statement of GPIO output for the number 27
else: #Else statement for the if statement above which shows if the if statement is not wrking than the statement below should work
GPIO.output(27, False) #False statement of GPIO output for the number 27
if digibini[0] =='1': #if statement of digibini for 0
GPIO.output(17, True) #True statement of GPIO output for the number 17
else: #Else statement for the if statement above which shows if the if statement is not wrking than the statement below should work
GPIO.output(17, False) #False statement of GPIO output for the number 17
time.sleep(1) #Number of seconds that it will stop/sleep