Created
April 6, 2017 04:52
-
-
Save RJ722/5cf2ca43881133c2e979b398e96865ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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