Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions xmaslights-spin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def xmaslight():
import neopixel
import re
import math
import json

# You are welcome to add any of these:
# import random
Expand All @@ -24,18 +25,8 @@ def xmaslight():

coordfilename = "Python/coords.txt"

fin = open(coordfilename,'r')
coords_raw = fin.readlines()

coords_bits = [i.split(",") for i in coords_raw]

coords = []

for slab in coords_bits:
new_coord = []
for i in slab:
new_coord.append(int(re.sub(r'[^-\d]','', i)))
coords.append(new_coord)
with open(coordfilename,'r') as fin:
coords = list(map(json.loads, fin.readlines()))

#set up the pixels (AKA 'LEDs')
PIXEL_COUNT = len(coords) # this should be 500
Expand Down