Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

Raspberry PI and Bicolor Matrix
Moderators: adafruit_support_bill, adafruit

Raspberry PI and Bicolor Matrix

by reddakota on Fri Nov 30, 2012 9:38 pm

I recently purchased the Bicolor LED matrix with i2c backpack for my raspberry pi, but it cannot get it to work properly. I run the ex_8x8_pixels.py file, but the coordinates aren't quite right. The x coords from left to right are 1-7 then the last column is 0 (zero).

Also the Adafruit Learning System explains the bicolors are controlled as an 8x16 matrix. I've tried setting both coordinates in range 0 - 16 but only the green LEDs light up.

Any suggestions?

reddakota
 
Posts: 9
Joined: Fri Nov 30, 2012 9:27 pm

Re: Raspberry PI and Bicolor Matrix

by reddakota on Sat Dec 01, 2012 1:26 pm

Well I solved the problem. The setPixel function in the Adafruit_8x8.py wasn't completely compatible so I wrote a setBicolorPixel() function.

Here is the code for anyone who wants it:

#color: 0=clear 1=green 2=red 3=orange
def setBicolorPixel(self, x, y, color=1)
if(x >=8):
return
if(y >= 8):
return

buffer = self.disp.getBuffer()

rowBuffer = buffer[y]

if color == 0:
rowBuffer &= ~(1 << x)

if color == 1:
rowBuffer |= 1 << x

if color == 2:
rowBuffer &= ~(1 << x)
x += 8
rowBuffer |= 1 << x

if color == 3:
rowBuffer |= 1 << x
x += 8
rowBuffer |= 1 << x

self.disp.setBufferRow(y, rowBuffer)

reddakota
 
Posts: 9
Joined: Fri Nov 30, 2012 9:27 pm

Re: Raspberry PI and Bicolor Matrix

by bsc on Wed Dec 05, 2012 3:41 am

reddakota wrote:...
I run the ex_8x8_pixels.py file, but the coordinates aren't quite right. The x coords from left to right are 1-7 then the last column is 0 (zero).
...
Any suggestions?


Maybe this is due to these 2 lines in the function setPixel(self, x, y, color=1) of the class EightByEight (possibly a remnant of the rotation support in the arduino Adafruit_LEDBackpack library , method Adafruit_8x8matrix::drawPixel() )

Code: Select all | TOGGLE FULL SIZE
    x += 7
    x %= 8
bsc
 
Posts: 2
Joined: Wed Dec 05, 2012 3:28 am

Re: Raspberry PI and Bicolor Matrix

by reddakota on Tue Dec 18, 2012 9:28 am

I created a git fork of Adafruits code. Fixed a bug with the code I posted above. I will upload a bicolor_8x8_ex.py soon for anyone interested.

https://github.com/reddakota/Adafruit-Raspberry-Pi-Python-Code

reddakota
 
Posts: 9
Joined: Fri Nov 30, 2012 9:27 pm