Commit 1eacc12b authored by Malte Schmitz's avatar Malte Schmitz

Fix C code

parent e4fe28e3
This diff is collapsed.
......@@ -9,4 +9,17 @@ img = Image.open("20px-color.bmp").convert('RGB')
width, height = img.size
pixels = [[p(img.getpixel((x,y))) for y in range(height)] for x in range(width)]
print("[" + ",\n".join(["[" + ", ".join(d) + "]" for d in pixels]) + "]")
array = "{" + ",\n".join(["{" + ", ".join(d) + "}" for d in pixels]) + "}"
code = """uint32_t[{width}][{height}] = {array};
for (int x = 0; x < {width}; x++) {{
for (int y = 0; y < {height}: y++) {{
strip.setPixelColor(y, pixels[x][y]);
}}
strip.show();
delay(50);
}}
"""
print(code.format(width = width, height = height, array = array))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment