Skip to content

Instantly share code, notes, and snippets.

@RJ722
Created April 6, 2017 04:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RJ722/5cf2ca43881133c2e979b398e96865ed to your computer and use it in GitHub Desktop.
Save RJ722/5cf2ca43881133c2e979b398e96865ed to your computer and use it in GitHub Desktop.
from RPi.GPIO import *
import time
setmode(BCM)
setwarnings(False)
# Physical Pins:
low_pins =
# Physocal Pins:
high_pins =
all = []
for i in all:
setup(i, OUT)
def make_all(param):
for i in all:
output(i, param)
num_led = 8
layout = [[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0]]
def glow_boundary(bound):
"""
This assumes boundary is square
"""
global layout
temp = len(layout) - 1
print temp
for i in range(len(layout)):
for j in range(len(layout[0])):
layout[bound][j] = 1
layout[temp - i][temp - bound] = 1
layout[i][bound] = 1
layout[temp - bound][temp - j] = 1
def glow_led_for_layout(layout):
for i in range(len(layout)):
for j in range(len(layout)):
if layout[i][j] == 1:
output(high_array[i], HIGH)
output(low_array[j], LOW)
def main():
for i in range(0, len(layout), -1):
# Make changes to the global layout
glow_boundary(i)
# Now make the led's glow according to the layout.
glow_led_for_layout(layout):
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment