I'm using this library: Centipede, found here: http://macetech.com/store/index.php?...products_id=23, with this setup: (this code for 5 different boards). PCB board layout attached.I have 5 of these RGB boards using the code below without issue, but I can't get a simpler version (the PBP code) with monochrome LEDs working.
/*PointsRGBTEST This is working copy.
RGB test BF29April2018
Code to check new RGB Points PCB as precursor to the big Star.
Test of matrix RGB activation. Uses MCP23017 I2C port expanders
at addresses 20 to 24 and special RGB Star point model. Sequences
through 7 colors (see below) for 16 lights. Does all one color
for 16, then next color for same 16. Note RED overwhelms other colors
so blue or green mixed in show red, instead of magenta and yellow.
*/
#include <Wire.h>
#include <Centipede.h>
Centipede CS;
const int pins[3] = {//9,10,11 are DIO pins for RGB transistors. Active high turns transistor on.
9, 10, 11 //use 9, 10, 11 because these are PWM pins on UNO
};
int x = 50;//delay between LEDs on/off //
int i;
byte b;
byte p;
const byte rgb[7] = {0x02, 0x04, 0x08, 0x05, 0x06, 0x0C, 0x0E,}; //00000010= 0x02
//Red overpowers other lights when lit in combination, eg with green or blue.
/*const byte Red = ~0x02; //0B00000010 Red on PB1 pin 9 of Uno invert bits 1 here is on, but must be zero for relay
const byte Green = ~0x04; //0B00000100 Green on PB2 pin 10
const byte Blue = ~0x08; //0B00001000 Blue on PB3 pin 11
const byte Magenta = ~0x05; //0B00001010 red and blue
const byte Yellow = ~0x06; //0B00000110 red and green
const byte Cyan = ~0x0C; //0B00001100 blue and green
const byte All = ~0x0E; //0B00001110 all lights should be white
const byte Seg0 = ~0x01; //0B00000100 Segment 0 on PD0, pin 0 of UNO
const byte Seg1 = ~0x02; //0B00001000 Segm*/
void setup() {
Wire.begin(); // start I2C
CS.initialize();
for (byte p = 0; p < 5; p++)//initialize all 5 port expanders
{ CS.portMode(p, 0x00);} //
// initialize the I/O pins as outputs
for (int i = 0; i < 3; i++) {
pinMode(pins[i], OUTPUT);
}
}
void loop()
{
for (byte b = 0; b < 7; b++)
PORTB = rgb[b]; //cycle 7 colors on pins 9,10,11
for (int p = 0; p < 16; p++)//16 needed to display LED 15
{CS.portMode(1, 0x00);
CS.digitalWrite(p, HIGH);//toggle light ON
delay(x);
CS.digitalWrite(p, LOW); //turn light OFF
delay(x);
}
}




Bookmarks