For anyone who wants the original code that Radio Shack supplies to their Level 1 Beginners, I had to post in a new message because of the message limit... This is what I had to work with originally.
#include <avr/pgmspace.h>
// ******** DEBUG ==== should auto config to adapt different mother board *********
#define DATA_1 (PORTC |= 0X01) // DATA 1 // for UNO
#define DATA_0 (PORTC &= 0XFE) // DATA 0 // for UNO
#define STRIP_PINOUT (DDRC=0xFF) // for UNO
PROGMEM const unsigned long pattern_test_red[10][10]={
{0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},
{0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},
{0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},
{0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},
{0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000},
{0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000},
{0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000},
{0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000},
{0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000},
{0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000},
};
//HAD TO ELIMINATE ABOUT 6 MORE PATTERNS BECAUSE OF MESSAGE LIMIT
PROGMEM const unsigned long pattern_all_on[10][10]={
{0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff},
{0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff},
{0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff},
{0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff},
{0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff},
{0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff},
{0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff},
{0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff},
{0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff},
{0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff,0xffffff},
};
// * Power Up Init.
void setup() {
STRIP_PINOUT; // set output pin - DEBUG: should auto detect which mother board for use
reset_strip();
//noInterrupts();
}
// * Main Loop
void loop()
{
int seconds=0;
//send_1M_pattern(pattern_all_on,10,100);
while (1)
{
send_digits_pattern(pattern_20digs_mix,seconds );
seconds++;
if(seconds>19)seconds=0;
}
}
// Function Name : send_1M_pattern
// Description : Transmit pattern to whole 1 meter strip
// Input : pointer to ROM pattern; pattern length; frame rate
void send_1M_pattern(const unsigned long data[][10], int pattern_no, int frame_rate)
{
int i=0;
int j=0;
uint32_t temp_data;
for (i=0;i<pattern_no;i++)
{
noInterrupts();
for (j=0;j<10;j++)
{
temp_data=pgm_read_dword_near(&data[i][j]);
send_strip(temp_data);
}
interrupts();
delay(frame_rate);
}
}
void send_digits_pattern(const unsigned long data[][9], int coutner)
{
int i=coutner;
int j=0;
uint32_t temp_data;
noInterrupts();
for (j=0;j<9;j++)
{
temp_data=pgm_read_dword_near(&data[i][j]);
send_strip(temp_data);
}
interrupts();
delay(1000); //1s
}
// Function Name : send_strip
// Description : Transmit 24 pulse to LED strip
// Input : 24-bit data for the strip
void send_strip(uint32_t data)
{
int i;
unsigned long j=0x800000;
for (i=0;i<24;i++)
{
if (data & j)
{
DATA_1;
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
DATA_0;
}
else
{
DATA_1;
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
__asm__("nop\n\t");
DATA_0;
}
j>>=1;
}
}
// Function Name : reset_strip
// Description : Send reset pulse to reset all color of the strip
void reset_strip()
{
DATA_0;
delayMicroseconds(20);
}