How do I write code for the Rainbowduino

Hello,

I have a rainbowduino, i think it is a really cool little board. It would be a lot cooler if i knew how to write code for the thing. For a couple weeks now I have been trying to figure out the functions and syntax for those functions…basically whatever i need to make custom code.

I have uploaded the plasma sketch onto it but that gets boring after a month. My dad and i have collectively gone hours and hours trying to figure out how to program this thing. We tried reverse engineering every piece of (working) code for it that we could find. My dad is a graduate from U of M and Cornell so i thought that he would be able to figure something out…Nope. We are both very frustrated by now and we just want this to work. Because there is almost no documentation on the how to write code for this our "adventures are even more difficult.

Here is a sketch that does not work for reasons we cannot figure out.

[code]/*

RedScreen

First example to turn the rainbowdouino red

*/
#include <math.h>
#include “Rainbow.h”
#include <avr/pgmspace.h>

#define screenWidth 8
#define screenHeight 8
#define paletteSize 64

void SetPixel(byte x, byte y, byte r, byte g, byte b);

void setup() // run once, when the sketch starts
{
_init();
}

void loop() // run over and over again
{
for(int x = 0; x < screenWidth; x++) {
for(int y = 0; y < screenHeight; y++) {
SetPixel(x, y, 255, 0, 0);
}
}
}

extern unsigned char dots_color[2][3][8][4]; //define Two Buffs (one for Display ,the other for receive data)
extern unsigned char GamaTab[16]; //define the Gamma value for correct the different LED matrix
unsigned char line,level;
unsigned char Buffprt=0;
unsigned char State=0;

void SetPixel(byte x, byte y, byte r, byte g, byte b)
{
x &= 7;
y &= 7;

/*
r = (r >> 4);
g = (g >> 4);
b = (b >> 4);
*/
if ((x & 1) == 0) {
dots_color[Buffprt][0][y][x >> 1] = r |
(dots_color[Buffprt][0][y][x >> 1] & 0xF0);
dots_color[Buffprt][1][y][x >> 1] = g |
(dots_color[Buffprt][1][y][x >> 1] & 0xF0);
dots_color[Buffprt][2][y][x >> 1] = b |
(dots_color[Buffprt][2][y][x >> 1] & 0xF0);
}
else {
dots_color[Buffprt][0][y][x >> 1] = (r << 4) |
(dots_color[Buffprt][0][y][x >> 1] & 0x0F);
dots_color[Buffprt][1][y][x >> 1] = (g << 4) |
(dots_color[Buffprt][1][y][x >> 1] & 0x0F);
dots_color[Buffprt][2][y][x >> 1] = (b << 4) |
(dots_color[Buffprt][2][y][x >> 1] & 0x0F);
}
}

void init_timer2(void)
{
TCCR2A |= (1 << WGM21) | (1 << WGM20);
TCCR2B |= (1<<CS22); // by clk/64
TCCR2B &= ~((1<<CS21) | (1<<CS20)); // by clk/64
TCCR2B &= ~((1<<WGM21) | (1<<WGM20)); // Use normal mode
ASSR |= (0<<AS2); // Use internal clock - external clock not used in Arduino
TIMSK2 |= (1<<TOIE2) | (0<<OCIE2B); //Timer2 Overflow Interrupt Enable
TCNT2 = GamaTab[0];
sei();
}

void _init(void) // define the pin mode
{
DDRD=0xff;
DDRC=0xff;
DDRB=0xff;
PORTD=0;
PORTB=0;
init_timer2(); // initial the timer for scanning the LED matrix
}[/code]

theoretically it changes all pixels of the rainbowduino matrix red, could someone tell us why it doesn’t work and please see if you can fix it? or share some links please.

Thank you,
nmelec.

Try to test the code here: http://code.google.com/p/rainbowduino/downloads/list

Regards,
Steve