Hi there again, is there any way to display text on the UnicornHAT in a similar way to how the Scroll pHAT is capable of working?
My goal is to show the current temperature on the UnicornHAT but so far the easiest way I see this being manageable is to create a .png image file that will display a number and then display this. However, to do this I would need to have something similar to this
temp0 = Image.open('0.png')
temp1 = Image.open('1.png')
temp2 = Image.open('2.png')
temp3 = Image.open('3.png')
temp4 = Image.open('4.png')
then have (I’m certain there’s an easier way of doing this, I just dont know how) if statements that check each temperature value like
if temp = 4:
for o_x in range(int(temp4.size[0]/8)):
for o_y in range(int(temp4.size[1]/8)):
for x in range(8):
for y in range(8):
pixel = temp4.getpixel(((o_x*8)+y,(o_y*8)+x))
r, g, b = int(pixel[0]),int(pixel[1]),int(pixel[2])
unicorn.set_pixel(x, y, r, g, b)
unicorn.show()
time.sleep(120)
unicorn.clear()
My temperature value is obtained from Forecast.io and is then rounded to an integer, I’ve got 120 images from -60 degrees to 60 degrees and writing if statements for these seems like it will become very tedious, is there a way to just pass a value and display this as text on the UnicornHAT?
Thanks for your help!