This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
octobrite [2009/07/27 05:28] macegr |
octobrite [2010/10/22 06:46] macegr |
||
---|---|---|---|
Line 7: | Line 7: | ||
{{octobrite_both_sm.png? | {{octobrite_both_sm.png? | ||
- | ^ Controller: | Texas Instruments | + | ^ Controller: | Texas Instruments |
^ LED Brightness: | 6000mcd per color | | ^ LED Brightness: | 6000mcd per color | | ||
^ LED Viewing Angle: | 120 Degrees | ^ LED Viewing Angle: | 120 Degrees | ||
Line 17: | Line 17: | ||
====== Power Connections ====== | ====== Power Connections ====== | ||
{{octobrite_closeup.png? | {{octobrite_closeup.png? | ||
- | The 5V pad is the logic power supply for the [[http:// | + | The 5V pad is the logic power supply for the [[http:// |
+ | |||
+ | **As is true of most digital electronics, | ||
====== SI (Serial In) ====== | ====== SI (Serial In) ====== | ||
Line 33: | Line 35: | ||
====== SO (Serial Out) ====== | ====== SO (Serial Out) ====== | ||
The SO pin is the output of the TLC5947 shift register. When the CL pin is pulsed, the MSB of the 288 bit register is written to the SO pin. Attach the SO pin to the SI pin of the next OctoBrite. This will allow a chain of OctoBrites to appear as a shift register with 288 bits times the number of OctoBrites. | The SO pin is the output of the TLC5947 shift register. When the CL pin is pulsed, the MSB of the 288 bit register is written to the SO pin. Attach the SO pin to the SI pin of the next OctoBrite. This will allow a chain of OctoBrites to appear as a shift register with 288 bits times the number of OctoBrites. | ||
+ | |||
+ | ====== Example Code ====== | ||
+ | The following Arduino code generates a scanning pattern in any color across any number of connected OctoBrites. It uses direct port access instead of the Arduino digitalWrite functions, which are significantly slower. | ||
+ | |||
+ | < | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | |||
+ | <span style=" | ||
+ | #define clockpin | ||
+ | #define enablepin | ||
+ | #define latchpin | ||
+ | #define datapin | ||
+ | |||
+ | <span style=" | ||
+ | #define CLKPORT PORTB | ||
+ | #define ENAPORT PORTB | ||
+ | #define LATPORT PORTB | ||
+ | #define DATPORT PORTB | ||
+ | #define CLKPIN | ||
+ | #define ENAPIN | ||
+ | #define LATPIN | ||
+ | #define DATPIN | ||
+ | |||
+ | <span style=" | ||
+ | #define NumOctoBrites 2 | ||
+ | |||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | uint16_t LEDChannels[NumOctoBrites*8][3] = {0}; | ||
+ | |||
+ | <span style=" | ||
+ | <span style=" | ||
+ | |||
+ | |||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | } | ||
+ | |||
+ | <span style=" | ||
+ | <span style=" | ||
+ | |||
+ | <span style=" | ||
+ | |||
+ | <span style=" | ||
+ | |||
+ | tempOne = *(& | ||
+ | |||
+ | <span style=" | ||
+ | <span style=" | ||
+ | DATPORT |= (1 << DATPIN); | ||
+ | } | ||
+ | <span style=" | ||
+ | DATPORT &= ~(1 << DATPIN); | ||
+ | } | ||
+ | CLKPORT |= (1 << CLKPIN); | ||
+ | CLKPORT &= ~(1 << CLKPIN); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | LATPORT |= (1 << LATPIN); | ||
+ | LATPORT &= ~(1 << LATPIN); | ||
+ | } | ||
+ | |||
+ | <span style=" | ||
+ | <span style=" | ||
+ | |||
+ | <span style=" | ||
+ | | ||
+ | <span style=" | ||
+ | | ||
+ | <span style=" | ||
+ | | ||
+ | brightnessfactor = <span style=" | ||
+ | | ||
+ | LEDChannels[LEDindex][0] = blue * brightnessfactor; | ||
+ | LEDChannels[LEDindex][1] = green * brightnessfactor; | ||
+ | LEDChannels[LEDindex][2] = red * brightnessfactor; | ||
+ | } | ||
+ | | ||
+ | WriteLEDArray(); | ||
+ | |||
+ | } | ||
+ | |||
+ | <span style=" | ||
+ | |||
+ | <span style=" | ||
+ | | ||
+ | <span style=" | ||
+ | LEDscan(4095, | ||
+ | <span style=" | ||
+ | } | ||
+ | |||
+ | <span style=" | ||
+ | LEDscan(0, 4095, 0, offset); | ||
+ | <span style=" | ||
+ | } | ||
+ | <span style=" | ||
+ | LEDscan(0, 0, 4095, offset); | ||
+ | <span style=" | ||
+ | } | ||
+ | |||
+ | }</ |