From 40a5b8e6964446e1c0e5efdb0c1cc7ee9888871a Mon Sep 17 00:00:00 2001 From: Daniel Barber Date: Thu, 20 May 2021 17:05:33 -0400 Subject: [PATCH] Update for Unicorn Hat HD --- fire.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/fire.py b/fire.py index b114cfb..5f6be44 100644 --- a/fire.py +++ b/fire.py @@ -1,16 +1,16 @@ from random import randint -import unicornhat as unicorn +import unicornhathd as unicorn from time import sleep -width = 8 -height = 8 +width = 16 +height = 16 rows = [] row_pointer = 0 colours = [] -unicorn.brightness(0.4) -unicorn.rotation(270) +unicorn.brightness(1) +unicorn.rotation(0) def init(): @@ -33,6 +33,8 @@ def init(): g = (i - 24) * 6 if i > 48: g = (i - 48) * 8 + if i < 16: + b = 4 - (i / 4) colours.append([r, g, b]) @@ -56,7 +58,7 @@ def update_rows(): # create fire for h in range(height): for w in range(width): - rows[h][w + 1] = (rows[h + 1][w] + rows[h + 1][w + 1] + rows[h + 1][w + 2]) / 3.4 + rows[h][w + 1] = (rows[h + 1][w] + rows[h + 1][w + 1] + rows[h + 1][w + 2]) / 3.3 def update_display(): @@ -95,6 +97,10 @@ def step(): init() -while True: - step() - sleep(0.05) +try: + while True: + step() + sleep(0.025) + +except KeyboardInterrupt: + unicorn.off()