allocom / Rainbow-HAT

32/64 LED HAT for Raspberry Pi
MIT License
7 stars 2 forks source link

Mini-Rainbow: led coordinates wrong #3

Open muizenis opened 5 years ago

muizenis commented 5 years ago

When trying to light up the right leds on the mini-Rainbow (8x4) with Python with x and y positions and set_pixel, both x and y seem to have a range with the length of 8 (0-7). Each second row of 4 leds seems to be a continuation of the first row of 4 leds. Example:

import time
import rainbowhat as rainbow

rainbow.set_layout(rainbow.PHAT)
rainbow.rotation(0)
rainbow.brightness(0.3)

for x in range(8):
    for y in range(4):
        rainbow.set_pixel(x,y,255,255,255)
        rainbow.show()
        time.sleep(1)

video1

Playing with rotation doesn't help. I'm using set_layout to set it to PHAT.

Example 2 (with rotation):

import time
import rainbowhat as rainbow

rainbow.set_layout(rainbow.PHAT)
rainbow.rotation(90)
rainbow.brightness(0.3)

for x in range(4):
    rainbow.set_pixel(x,0,255,255,255)
    rainbow.show()
    time.sleep(1)

for x in range(4):
    rainbow.set_pixel(x,1,255,0,0)
    rainbow.show()
    time.sleep(1)

results in this:

video2