//Arduino Mega Sketch to drive strands and matrices of WS2801 pixels with Glediator. //(c)2012 by R. Heller //wwww.solderlab.de //Set Baudrate in Glediator to 1MBit !!! //Change this to YOUR matrix size!! #define Num_Pixels 300 //Serial Data Output (Arduino-Mega Pin 6) #define SDO_Port PORTH #define SDO_DDR DDRH #define SDO_Pin 3 //Arduino-Mega Pin 6 //Serial Data Clock (Arduino-Mega Pin 7) #define CLK_Port PORTH #define CLK_DDR DDRH #define CLK_Pin 4 //Arduino-Mega Pin 7 //############################################################################################################################################################ // Don't change anything upon here! # //############################################################################################################################################################ #define Set_CLK_Low CLK_Port &= ~(1 << CLK_Pin) #define Set_CLK_High CLK_Port |= (1 << CLK_Pin) #define Set_CLK_Output CLK_DDR |= (1 << CLK_Pin) #define Set_SDO_Low SDO_Port &= ~(1 << SDO_Pin) #define Set_SDO_High SDO_Port |= (1 << SDO_Pin) #define Set_SDO_Output SDO_DDR |= (1 << SDO_Pin) #define CMD_NEW_DATA 1 unsigned char display_buffer[Num_Pixels * 3]; static unsigned char *ptr; static unsigned int pos = 0; volatile unsigned char go = 0; void setup() { Set_SDO_Output; Set_CLK_Output; //Disable global interrupts cli(); //UART Initialisation UCSR0A |= (1<