Raspberry PI and Bicolor Matrix

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Raspberry PI and Bicolor Matrix

Postby reddakota » Fri Nov 30, 2012 8: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: 3
Joined: Fri Nov 30, 2012 8:27 pm

Re: Raspberry PI and Bicolor Matrix

Postby reddakota » Sat Dec 01, 2012 12: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: 3
Joined: Fri Nov 30, 2012 8:27 pm

Re: Raspberry PI and Bicolor Matrix

Postby bsc » Wed Dec 05, 2012 2: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
    x += 7
    x %= 8
bsc
 
Posts: 2
Joined: Wed Dec 05, 2012 2:28 am

Re: Raspberry PI and Bicolor Matrix

Postby reddakota » Tue Dec 18, 2012 8: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: 3
Joined: Fri Nov 30, 2012 8:27 pm


Return to Glowy things (LCD, LED, TFT, EL) purchased at Adafruit

Who is online

Users browsing this forum: No registered users and 7 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [105]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]